Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

lol java

Name: Cudder !cXCudderUE 2015-07-22 4:58

I had to convert from one multipage vector document format to another, and found an opensource application that claimed to be able to do it. It was written in Java, which is a bad sign already, but I just wanted something for this conversion - I only needed to convert a few files. The first file I tried it on, which was ~20MB and several hundred pages, caused it to run out of memory. Smaller ones (<1MB, around 10 pages) were OK.

I narrowed down the problem to it trying to keep the entire generated output file in memory and allocating a bitmap to render each page.

Both the input and output document formats are designed precisely so you don't have to keep the whole file in memory, and they're primarily vector formats so there should be no bitmap rendering either. (Each page in the first document I tried is roughly 20-30KB in vector format, including small embedded bitmaps.)

By limiting it to a small range of pages and pushing the JVM memory limits to their max I got it to generate an output file. 6 seconds for 10 pages of medium complexity, which take much less than a second for the original document to render in the native viewer. That's not a good sign either, but what's worse is when I opened the output file, all the pages were blank! Each one had nothing more than a single embedded bitmap with all white pixels.

WTF? This is pathetic. Do Java programmers these days not even think carefully about the algorithms they're using anymore? These are very close formats, basically all that's necessary is to open the input file, parse headers, write translated version to the output, then in the main loop read a vector command from input (several tens of bytes), translate coordinates and units, and write the equivalent command to the output. Embedded bitmaps are supported in both formats and the raw data is essentially identical, so just stream it through. It's definitely doable in <1MB of constant memory, and yet the idiot(s) who wrote this shit thought they needed to read the entire fucking file into memory, parse and create millions of objects, render them into bitmaps (again, all allocated in memory, one for every page) and then create an output file, again in memory, consisting entirely of embedded bitmaps!? Even with enough memory it was broken.

I'm not going to fix it because the source is typical ENTERPRISE QUALITY JAVA with several hundred classes each of which does very little. Writing my own converter would probably take much less time.

Name: All Talk and No Action! 2015-07-22 5:01

Name: Anonymous 2015-07-22 5:02

Good Java programmers would never write a program so shitty. Fuck off. Basic Freshman Year CS shit.

Name: Cudder !cXCudderUE 2015-07-22 5:13

>>3
Most Java programmers are not "good".

Basic Freshman Year CS shit
No, that involves evangelising abstraction and preaching the "premature optimisation is the devil" bullshit.

Name: Anonymous 2015-07-22 5:48

I used to do Java for a living. It is a very ideologically driven design that is painfully obvious at every step. Seeples' template and multiple inheritances messes are small fried compared to the atrocities an OOP monkey can commit. Got a problem? Add a class? IntegerAbstractSingletonFactoryFactoryBuilder is not just a joke. And anyone who talks about beans with a straight face should be avoided like a black faggot rapist. It's just a class with too many getters and setters (just in case, you, er, stuff) that's serializable, but somehow that's some profound thing in ENTERPRISE.

It was not fun. Having to step through forty classes to find the source of a single exception is awful and made me regret becoming a programmer. The thirty-second lag between input and response in Eclipse didn't help.

Bad stuff.

Name: Anonymous 2015-07-22 7:25

premature optimisation is the devil

Name: Anonymous 2015-07-22 12:06

>>2
Smoke weed every hour.

Name: Anonymous 2015-07-22 16:48

>>4
FUCK OFF

Name: Anonymous 2015-07-23 1:26

>>8
My BTC wallet is 1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX. I'm a marginalized trans developer and I think you owe me reparations for having slain me this morn

Name: Anonymous 2015-07-23 2:19

>>3
Good Java programmers
lol

Name: Anonymous 2016-07-11 5:49

(stopping the dubsfaggot from dubsbumping)

Name: Anonymous 2016-11-10 17:16

>>4
preaching the "premature optimisation is the devil" bullshit.
Says the one who's so busy prematurely optimizing that she has yet to write a single line of code.

Name: Anonymous 2016-11-10 18:48

>>12
Cudder is all optimization and no compilation

Name: Anonymous 2016-11-10 20:03

Yeah why should I prematurely optimize? I just have to render each page in a bitmap in memory and it'll be Ok. Premature optimizers take months coding but I just had to write only 100 Java classes!

Don't change these.
Name: Email:
Entire Thread Thread List