Hacker News new | past | comments | ask | show | jobs | submit login

"I thought, “Hey, I’m a Web Developer™! I should use JavaScript for this because JavaScript is the best lol!” "

While that's clearly meant to be somewhat of a joke (from a medium account called dailyjs as well), it's this kind of annoying attitude that has lead to js being forced into lots of other avenues.

Also, is js really even the best tool for this? I feel like you're going to get far better pictures and faster results from language closer to the metal like C/Rust/Java(???).




JS is almost never the "best" tool for any job. But the browser is (arguably) the most pervasive environment, reaching the largest audience, so JS has the farthest potential reach of any tool. That is the trade off of web development -- pick a sub-optimal tool in exchange for highest potential market share.

In other words... No. But experimenting with JS still can have value.


Sure, you'll be able to render faster. But how much time will you spend building a UI? And you still won't have anything to inline in the web page. Part of the appeal of doing this kind of stuff in JS is to be able to share it without requiring people download and install something.

Realistically speaking, any toy fractal renderer like this will be an order of magnitude or two away from a heavily tuned one employing every trick in the book anyway, regardless of language.


> you still won't have anything to inline in the web page.

How about a good old-fashioned image that doesn't require the viewer have JS enabled?


Recently I was fiddling with Julia sets. I find the HTML5 canvas quite comfortable to work with, and after implementing the renderer as a WebGL shader, it was a snappy update/refresh/get feedback loop.

Javascript is a nice hacking tool if you keep it in the browser.


If you want to generate fractals in-browser? Y... actually, no, at least not for modern browsers.

WebGL is, and the author actually uses this for his "final" implementation (linked from article).

I sort of get the JS hate (sort of) but if you want to do things in the browser then you're either using JS, or something that compiles to JS, or WebGL (1).

(1) If you're really lucky and only care about targeting supporting browsers you might also consider WebAssembly, and then you can use C or Rust, but for many scenarios that's still not an option. (And I doubt it would be faster than a shader-based WebGL implementation that runs on the GPU, for this scenario.)


> Also, is js really even the best tool for this?

For visualizing the Mandelbrot set? No. For writing an article on the web about incrementally building it up? Yes.


I think this just benchmarked my browser.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: