Live data from Hacker News

Tofu – The opposite of a font

github.com

1–10 of 66 posts

Re: Tofu – The opposite of a font

#3
WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG IT WOULD TAKE. I USED A RAM DISK

I haven't looked at the implementation, but this seems to imply it is very I/O intensive and already takes a very long time in RAM. Yet, nothing about the problem statement suggests it would be such a task --- it sounds like something that could be very straightforwardly done completely in memory.

Re: Tofu – The opposite of a font

#4
> WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG IT WOULD TAKE. I USED A RAM DISK

How much disk IO does this program generate? Why?

In any case, the OS should cache stuff and give similar performance to using a ramdisk, provided you have enough spare ram.

Re: Tofu – The opposite of a font

#5

WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG IT WOULD TAKE. I USED A RAM DISK I haven't looked at the implementation, but this seems to imply it is very I/O intensive and already takes a very long time in RAM. Yet, nothing about the problem statement suggests it would be such a task --- it sounds like something that could be very straightforwardly done completely in memory.

It's just that the python library used won't read SVG from a string, online from a file given a filename, so each character must be written to disk, then read back in.

Re: Tofu – The opposite of a font

#6

> WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG IT WOULD TAKE. I USED A RAM DISK How much disk IO does this program generate? Why? In any case, the OS should cache stuff and give similar performance to using a ramdisk, provided you have enough spare ram.

> the OS should cache stuff

When I worked at Microsoft back in the 90's I inquired around building 26 as to why I couldn't create a ram disk on what was to become Windows 2000, and this was basically the answer. So yes, if caching doesn't solve this then caching hasn't been implemented correctly.

Re: Tofu – The opposite of a font

#9

WARNING: PLEASE DO NOT RUN THIS CODE ON A HARD DRIVE, I'M NOT SURE HOW LONG IT WOULD TAKE. I USED A RAM DISK I haven't looked at the implementation, but this seems to imply it is very I/O intensive and already takes a very long time in RAM. Yet, nothing about the problem statement suggests it would be such a task --- it sounds like something that could be very straightforwardly done completely in memory.

It's just that the python library used won't read SVG from a string, online from a file given a filename, so each character must be written to disk, then read back in.

Wow. To me that's definitely in the realm of "fix this if you need to run this program more than once" inefficiency. After looking at the implementation, it doesn't seem like it takes advantage of TTF's "composite glyphs" feature either, which would be the most straightforward way of generating a font like this --- once you define the box and the digit glyphs, each character is then composed entirely of references to the box and the appropriate digit glyphs.

Re: Tofu – The opposite of a font

#10
post #7

how would one go about running code/operations on ram as opposed to the hd?

On most operating systems you can use part of your RAM as disk. Format it like a regular disk, mount it and save files on it.

The data is gone if you restart tho.

Post reply on HN