[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 32
Thread images: 3
File: HTML (?).png (1 MB, 2530x1005) Image search: [Google]
HTML (?).png
1 MB, 2530x1005
>Modern web """"programming""""
>>
The code is minified and inline to reduce HTTP requests and page load time.

I see nothing wrong with this.
>>
>>54474089
I'm seeing a lot of Google there.
>>
>>54474089
Is that hand written or generated code?
>>
protip: spacing it out and indention are only useful to us. to a computer, it really doesn't matter.
>>
>>54474193
generated or handwritten and then used a program to go over and get rid of the stuff to make it human readable to decrease load time and strain.
>>
>>54474089
Obviously compiled for efficiency. Most places use some kind of tool to do this.
>>
>>54474221

what program do I use for this?
>>
>>54474226
There are lots. You can even use a diferent language, like CoffeeScript or TypeScript and then use that to generate JavaScript.
>>
“When I use a word,” the web programmer said, in rather a scornful tone, “it means just what I choose it to mean—neither more nor less
>>
>>54474236

Would doing this for Java make a difference or benefit my compile time in any way? Isn't each blank space a bit that the compiler has to read over?
>>
>>54474266
Hardly. Java's compiler is pretty good. You'll only see a usable benefit if you compile on a macro scale (say, if you compile on many machines, or if you intend to compile 1,000,000 times or whatever). Otherwise, you can save 0.01 seconds because it didn't have to throw aways some spaces.

Code readability is infinitely more important. It's the real timesaver. That's why you should name your variables verbosely. Even things like characterIndex for iterating a character array is better than just "i" because even though it's widely known that 'i' stands for index, it tells you what the index is good for.
>>
>>54474337

If I were to do it I would simply save two versions, the compressed version and the version for editing. Any time I made an edit I would have to recompress it. But if it makes no difference in compile time, like say for a mobile app, then I'm wasting my time.
>>
>>54474377
It would take more time to compress your code than to compile it.
>>
>>54474089
Holy shit, how new are you to this? Seriously
https://htmlcompressor.com/
>>
>>54474413

I don't mean compress it every time I run it dude. And I don't mean compress it to a zip or some shit. I mean just compress it once for the official app release, as in - get rid of excess spaces and lines similar to OP's picture.

Do you have a source showing that this is a futile effort?
>>
>>54474481
Common sense/experience writing interpreters. I really don't know the amount of timesave you're expecting, but you will lose more time than you save.
>>
>>54474266
No. Compiling java generates binary byte code which is pretty much as small as it gets. The js minification just removed whitespace, newlines and comments. It's still very easy to reformat it.
I use grunt to do minification and beautification it's kinda like make for javascript, it runs tasks that you define in a grunt file like minifying, linting, combining files and whatnot. There's a lot of plugins available and you basically just type grunt on the command line in your project folder and it'll do all you tasks in one go.
Very useful. I suggest you all check it out if your not familiar with it.
>>
>>54474337
'i' stands for iteration you dumbfuck
>>
>>54474337
>>54475894
i stands for "i stands for", retards
>>
>>54474266
Im sure having a program remove whitespaces before compiling is going to make it much faster. I don't see a single Problem with this idea.
>>
>>54474089
>>Modern web """"programming""""
Isn't programming, but certainly is decent based off the image you linked. That's pretty smart.
>>
File: msbs26.jpg (29 KB, 315x480) Image search: [Google]
msbs26.jpg
29 KB, 315x480
>>54474337
>even though it's widely known that 'i' stands for index, it tells you what the index is good for
>>
People should only be allowed in web-development after writing a html-parser.
>>
Fuckin kek.
>>
>>54475977
"i" stands for "thing", but in the olden days, when code was printed out on paper for people to read, a printer didn't reproduce the "t" exactly and it missed the bar, so it resulted in "i" being written out.
>>
>>54476348
I concur. Bitches be crazy these days.
>>
>>54476245
Web development is programming, because Javascript is a programming language.
>>
>>54476348
People should only be allowed to write JavaScript libraries after writing a JavaScript JIT.
>>
>>54474089
That's called minifying and is done to minimize load times.
As far as my experience goes it doesn't really have a big impact on anything but I think its mostly done for SEO.

(Also, that code is mostly js and CSS.)
>>
>>54474266
Yes, but not significantly.

The reason you do it with Javascript is because the 'compiling' is done every time someone loads the page. So to increase page load time by fractions of a second pays off.
>>
File: 1461465673404.jpg (179 KB, 404x521) Image search: [Google]
1461465673404.jpg
179 KB, 404x521
>>54474089
>I'm a massive faggot, please rape my face
Thread replies: 32
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.