HNHacker News
TopNewBestAskShowJobs

floitsch

707 karma · joined March 29, 2013

I worked on Dart. Now developing Toit.
submissionscomments
floitsch··on Wuhan market was epicentre of pandemic’s start, studies suggest
Occam's razor states: "entities should not be multiplied beyond necessity".

Given that viruses have multiple times spread from animals to humans this would be the simplest explanation, favored by Occam's razor.

That said, the scientific community has not ruled out a lab leak.

The Atlantic generally has very good articles on where the investigation stand, and how different people interpret the probabilities/coincidences.

For example https://www.theatlantic.com/science/archive/2021/09/lab-leak...

Given that China is not really interested in any conclusion on this topic (except if the virus was imported from a different country) we will probably never know.

floitsch··on Push-ups with Python, mediapipe and OpenCV
I know of at least one start-up that is using video and AI to give feedback on training sessions: http://formfirst.app

In some way the program should be much better at detecting faults than a human, but I'm not sure if the population is ready to trust applications yet.

However the potential of combining training feedback with gamified sessions that are geared towards a specific individual has huge potential imho.

floitsch··on Show HN: Google Apps add-on for syntax highlighting
This is an add-on to write code in Google docs and presentations.

When I worked at Google there was an add-on go/kodify which allowed to write code segments inside Google docs and then use it to syntax highlight all code.

When I left Google I decided to recreate such an add-on. I added a few tweaks here and there and made it work for presentations as well.

The code is open-source at https://github.com/floitsch/syntax-addon

floitsch··on Advent of Code 2021
Perfect time to explore Toit (http://github.com/toitlang/toit) :)
floitsch··on The Toit language is now open source
We get a lot out of having static classes and methods that can't change dynamically. This allows us to use the selector-based row displacement technique for building a compact method dispatch table. (See https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.29...)

Many small decisions help keeping the system fast. The memory layout, the bytecodes, the FFI interface, ...

Separating the compilation process from the running process obviously also helps. It gives us the option to do slower optimizations before-hand, and not pay for them at runtime. (Independent of the fact that the ESP32 wouldn't be able to do big optimizations anyway).

This is actually an area we haven't really spent too much time on yet: optimizations. The current compiler doesn't even do inlining yet. The speed of Toit was never really a problem, and we preferred to spend time elsewhere. Eventually, we will definitely do more there again.

floitsch··on The Toit language is now open source
Toit doesn't have generic types yet. This limitation means that the dynamic checks are very fast.

Since these checks also allow some optimizations, the cost of the dynamic checks is maybe 10-15%. And that's before doing a global type-inference, which should remove many of the checks.

floitsch··on The Toit language is now open source
I compiled the VM to WASM and ran the bytecode in it.
floitsch··on The Toit language is now open source
Toit is optionally typed, and supports type annotations.

Type annotations for locals, fields, and globals are written with a trailing `/Type`. Return types are written with `-> ReturnType`.

See https://github.com/toitware/toit-lsm303dlhc/blob/main/src/ac... for a file I recently edited.

When a type annotation is written, the compiler enforces it. It uses it for static optimizations, and dynamically checks that the type is correct.

When a type can be null, it has to be suffixed by `?`.

floitsch··on The Toit language is now open source
The Toit language isn't bound to run on ESP32s.

We routinely run it on our desktops as well.

floitsch··on The Toit language is now open source
To me those two sound quite different.

Here is, how we pronounce it: https://www.youtube.com/watch?v=JVKb8cm1B20

floitsch··on The Toit language is now open source
I believe I once managed to make Toit run in web-assembly.

I know for sure that the compiler compiled to it, but I'm pretty sure I also had a "hello world" that worked.

I would need to find that branch and see if it still merges cleanly.

floitsch··on The Toit language is now open source
It's not Go ;)

In all seriousness, though: if you like Go, then tinygo could be a good solution.

Personally, I find coding in Toit just a much more pleasant experience.

floitsch··on The Toit language is now open source
It's this one: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.29...
floitsch··on European Payments Initiative (EPI)
Note that "nets" is on the list.

They represent 250 banks across Europe (according to their web-page): https://www.nets.eu/who-we-are

For example, Danske Bank (the biggest Danish bank) uses them.

floitsch··on European Payments Initiative (EPI)
Credit card payments in Europe now have to have 2-factor authentication.

This makes fraud much harder, while still allowing online payments with credit cards.

It is probably also helping smaller shops, as even Amazon customers now need to do something when they buy there.

floitsch··on Finland provides housing and counseling to the homeless (2020)
That's why you compare per capita.
floitsch··on Finland provides housing and counseling to the homeless (2020)
Finland is not really a country that relies heavily on natural resources.

First page I found ranks the US as having more income from natural resources than Finland.

https://www.theglobaleconomy.com/rankings/natural_resources_...

floitsch··on An efficient way to make hash maps with insertion ordering
It's not that simple.

The index table needs to be sparse (for the hashing to work), and thus has quite a few entries unused. It also wants to be small in memory to improve cache locality.

Therefore you want to have the entries in the index-table as small as possible.

As example, let's say you have n entries in your map which is 2/3 full. Let's assume the key and the value each take 1 word.

In the index+key+value case you would thus use: n1.5 words for the indexes, and n2 words for the keys/values. -> 3.5 words per stored key/value.

In the key+value case you would need (2n)1.5 words. -> 3 words per stored key/value.

However, that assumes that the index-table uses a full word per entry. That's usually not the case, as you can use smaller types while the map is small enough. On 64-bit machines, the index-table will rarely use more than 32-bit arrays. In that case you would only need 2.75 words per stored key/value.

That's not really fair, though, as the value/key table has some unused space, so that it doesn't reallocate/copy every time a new key/value is added. Implementations can play with how much extra space is allocated for those unused slots.

Also, the "hash" you mentioned can be combined with the redirecting index. For Toit (the map of the blog post), the index table uses 32 bits. In these 32 bits it stores both (part of) the hash code, as well as the redirecting index.

It might be the case that the hash+key+value approach uses less memory, but I would not be confident to say that it's always the case.

floitsch··on An efficient way to make hash maps with insertion ordering
Which unavoidable memory overhead?

The hash map as described in the article doesn't seem to waste any memory.

floitsch··on An efficient way to make hash maps with insertion ordering
You were stating that "[...] it definitely is using memory it wouldn't need if it didn't preserve order.".

There is no reason for that. A sorted list doesn't need more memory than an unsorted list. And an insertion-sorted map doesn't need to use more memory than a map that doesn't keep the order.

Independently, some properties we deem valuable are often side-products of the way the data-structure works. For example, an efficient binary search tree will naturally tend to be balanced. In the case of efficient hash maps, it is now common to add the key/value pair at the end of an internal vector. Maintaining the insertion order this way doesn't add any cost.

floitsch··on An efficient way to make hash maps with insertion ordering
With that reasoning a sorted list would need more memory than an unsorted list.
floitsch··on An efficient way to make hash maps with insertion ordering
Rust has hash maps that hate you.

The default hash map visits the keys in arbitrary order (https://doc.rust-lang.org/std/collections/struct.HashMap.htm...).

You could use a BTreeMap, but that's not insertion order and requires the user to come up with some sort of ordering.

floitsch··on Ten Kilograms of Chocolate (2020)
The brand seems to be available mostly in Germany and Denmark.

A very similar chocolate seems to be Vivani (from the same manufacturer). "Vivani edel bitter 70%". Maybe that one is easier to find.

floitsch··on Ten Kilograms of Chocolate (2020)
If it had been available in common Danish supermarkets I would have included it :)
floitsch··on Ten Kilograms of Chocolate (2020)
As mentioned in the post: the Cote d'Or and Suchard chocolates are extremely similar, and only had a minor difference in the ingredient list. If we had known, we would not have included both.
floitsch··on Ten Kilograms of Chocolate (2020)
Will keep that in mind.

It's very hard to present tables on Medium. If someone knows a better technique I would be happy to learn about it.

floitsch··on Ten Kilograms of Chocolate (2020)
Happy to answer questions about the participants.

For the "Knack": I'm not 100% sure either. I think he meant that it had a nice snap/crunch.

floitsch··on Can you IoT an Airwick air freshener? (2020)
Me too. I used the existing board and connected myself directly to the transistor.

Used http://toit.io to connect the ESP32 to the cloud so I could control it from my phone (with a tiny Flutter app).

floitsch··on Identical twins are not so identical, study suggests
This is pretty rare. Almost all test of twins that are in doubt are identical.

Don't have a source right now but I remember because we wondered if we should take a test as well. In retrospect (now 40+ years old and still looking very similar) it's hard to understand why we every doubted.

floitsch··on Why is subtracting these two times in 1927 giving a strange result? (2011)
I implemented (part of) the Dart date/time library. Lots of fun stuff with time zones...

Wrote a blog post about the most interesting things I found: https://medium.com/@florian_32814/date-time-526a4f86badb

← PreviousPage 3 of 5Next →