Originally posted by d000hg
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Trying out Chrome - how do they make it so fast?"
Collapse
-
Originally posted by VectraMan View PostThat's very clever, but obviously relies on the programmer using Javascript's pesudo-class implementation (i.e. using a constructor function). If the programmer just uses new object() and adds properties to it willy nilly, then it can't possibly do the same as it has no way of knowing what the properties will be. May as well have classes; it's less confusing than messing about with prototypes.
For example, the following code:
Code:var foo = {}; foo.bar = 1; foo.baz = 2; var blob = {}; blob.bar = []; blob.qaz = 'a'; var x = {}; x.bar = foo;
Code:// assume hidden class A represents an object with nothing but default properties foo becomes an instance of existing hidden class A; foo has property "bar" added: it becomes an instance of new hidden class B, which descends from A; foo has property "baz" added: it becomes an instance of new hidden class C, which descends from B; blob becomes an instance of existing hidden class A; blob has property "bar" added: it becomes an instance of existing hidden class B; blob has property "qaz" added: it becomes an instance of new hidden class D, which descends from B; x becomes an instance of existing hidden class A; x has property "bar" added: it becomes an instance of existing hidden class B; // so at this point: // foo is an instance of C // blob is an instance of D // x is an instance of B delete blob.qaz; // blob can now go back to being an instance of B
Although Google's examples use the "new" keyword and constructors, all that really does is the same kind of thing as the above, with the addition of setting the "prototype" property of the new object. According to Brendan Eich, this was only added to the language at the behest of Netscape's marketing people, who wanted it to look more like Java. At ClientOrg last year, we outlawed the use of "new" almost completely and didn't miss it.
Originally posted by VectraMan View PostI was more referring to the low level lack of type problems. For example, in C++, if you have a + b and the compiler knows a and b are ints, then it just inserts the code to add two ints In Javascript, it doesn't know what the types are, so you end up with this sort of thing:
Code:typeA = GetType(a) typeB = GetType(b) if(typeA == int AND typeB==int) { integerAdd (a,b) } else if (typeA == string AND typeB == string) { stringAdd(a,b) } else if(typeA == string AND typeB == int) { AddIntToString(a,b) } else ....
Code:function concatenateStrings(first, second) { // allocate new buffer having length first.length + second.length // copy first into new buffer // copy second into new buffer at offset first.length // return new buffer as type string } function concatenateStringAndNumber(string, number) { return concatenateStrings(string, number.toString(10)); } function addNumberAndString(number, string) { return addStringAndNumber(string, number); } function addNumberAndNumber(number1, number2) { // return the sum of the two numbers } addFunctions = { string: { string: concatenateStrings, number: concatenateStringAndNumber }, number: { string: addNumberAndString, number: addNumberAndNumber } }; function whatWeDoWhenAdding(value1, value2) { addFunctions[typeof value1][typeof value2](value1, value2); }
Originally posted by VectraMan View PostI'm sure the new engines are very clever and can predict a lot to solve these problems, but it can't predict everything. But it could with the relatively simple addition of strong typing.
Originally posted by VectraMan View PostAnd Google obviously agree with me about JS not matching true native code because they're pushing ahead with their plans for sandbox'd downloaded native code.
Leave a comment:
-
JS doesn't need to be as fast as C++... few apps are written in C++. If they can get it as fast as Java or Python that's good enough...
Leave a comment:
-
Originally posted by NickFitz View PostThe language is dynamically typed, but that doesn't mean that the runtime has to lose performance by doing dynamic property lookup. V8 internally converts dynamic JS objects to hidden classes. For the vast majority of cases, the code runs with the same advantages as statically-compiled code.
I was more referring to the low level lack of type problems. For example, in C++, if you have a + b and the compiler knows a and b are ints, then it just inserts the code to add two ints In Javascript, it doesn't know what the types are, so you end up with this sort of thing:
Code:typeA = GetType(a) typeB = GetType(b) if(typeA == int AND typeB==int) { integerAdd (a,b) } else if (typeA == string AND typeB == string) { stringAdd(a,b) } else if(typeA == string AND typeB == int) { AddIntToString(a,b) } else ....
I'm sure the new engines are very clever and can predict a lot to solve these problems, but it can't predict everything. But it could with the relatively simple addition of strong typing.
And Google obviously agree with me about JS not matching true native code because they're pushing ahead with their plans for sandbox'd downloaded native code.
Leave a comment:
-
Originally posted by Shimano105 View PostChrome doesn't support NoScript plugin, so for that reason I'm out.
If you want NoScript for things like blocking JavaScript, blocking images from advertising sites, or disabling plugins like Flash, then you can do all that in Chrome's preferences with no extension needed: go to the "Under the Hood" tab and click "Content settings...". Note that you have the option, for each of the content types shown there, of either blacklisting all sites and then adding acceptable sites to a whitelist, or whitelisting all sites and blacklisting unacceptable sites.
Leave a comment:
-
Chrome doesn't support NoScript plugin, so for that reason I'm out.
Leave a comment:
-
Originally posted by VectraMan View PostPoint of order: just because something converts to native code doesn't make it as fast as native code. It's quite easy to convert interpreted bytecode to native code: you just make the native code do the things the interpreter would do. Doesn't make it the same as native code from a language like C++.
Originally posted by VectraMan View PostSeems to me JavaScript has a fundamental problem: it's still dynamically typed. If they'd get organised and adopt something similar to the ActionScript 2 style class system (as was in the now defunct ECMAScript v4 spec IIRC), a) it would become a much more realistic language for the larger scale applications webists want us to write and win over the real programmers, and b) strong types would help enormously with optimisation and in many cases could rival C++ for performance.
Many of the details are available at the V8 project site (and of course it's open source, so you can read the code to see exactly what's going on if you wish).
Originally posted by VectraMan View PostIt's a shame with all this newfangled attention on JavaScript, nobody's bothered to improve the language.
Originally posted by VectraMan View PostQuite impressive IE9 animation demos on that link above. Is using the GPU unique to IE9, or are Firefox and Chrome et al going to catch up?
Leave a comment:
-
Um, dynamic typing is a deliberate feature of the language. If they wanted it to be C they'd have used C. Higher level languages let you write code faster do do more complex stuff, the job is then to minimise the performance impact that results.
Leave a comment:
-
Originally posted by NickFitz View PostFor JavaScript, Google created their own scripting engine called V8 which uses a load of clever techniques to optimise execution. It also compiles to native code, rather than an interpreted bytecode, so JS applications can run at pretty much the speed of native code. This has led to a speed war amongst the browser makers: Firefox's TraceMonkey beats V8 on some benchmarks, Safari's Squirrelfish Extreme (which also compiles to native code) claims a 36% improvement over V8, Opera's Carackan (native code compilation again) hasn't quite caught up with WebKit and Chrome yet (though they're working on it), and the IE Team claim that the latest preview of IE9 has overtaken Firefox.
Seems to me JavaScript has a fundamental problem: it's still dynamically typed. If they'd get organised and adopt something similar to the ActionScript 2 style class system (as was in the now defunct ECMAScript v4 spec IIRC), a) it would become a much more realistic language for the larger scale applications webists want us to write and win over the real programmers, and b) strong types would help enormously with optimisation and in many cases could rival C++ for performance.
It's a shame with all this newfangled attention on JavaScript, nobody's bothered to improve the language.
Quite impressive IE9 animation demos on that link above. Is using the GPU unique to IE9, or are Firefox and Chrome et al going to catch up?
Leave a comment:
-
ChromeOS is just a Linux variant with hacks in to only run on SSDs and prevent you installing any local applications. As Linux it doesn't need much resources the way they will be configuring it... but it's the fact they want to force you to run apps through the browser, so they control all the data-flow, which is a little creepy
Leave a comment:
-
Originally posted by lilelvis2000 View PostAs always Nick, superb.
My impression is that Chrome is just that tick or two faster rendering. On slow machines this is even more apparent. (to me anyway).
I also don't really agree agree on the slimmed functionality, I downloaded Chrome developer channel version with some cool extensions like Speed Tracer (so I could optimise CSS rendering speeds) and at least for me, Chrome is already providing more useful developer tools than other browsers (with the exception of Firebug perhaps) and it will only get better.
Leave a comment:
-
As always Nick, superb.
My impression is that Chrome is just that tick or two faster rendering. On slow machines this is even more apparent. (to me anyway).
Leave a comment:
-
There are two major things that make Chrome seem so fast: the rendering engine, and the JavaScript engine. The first is going to make an impression in general surfing, and the second when using web applications such as Google Maps or Google Docs.
For rendering, Chrome uses Apple's WebKit, which also powers Safari: Apple spun it off as an open source project, so there are other browsers using it too, such as the Nokia S60 browser. (In fact, WebKit was itself a fork of the open source KHTML project.) The WebKit Architect is Dave Hyatt, who used to be at Netscape and Mozilla - he implemented tabs in Firefox amongst other things. He has blogged a lot about the work that goes into improving rendering performance: here's a post from his old (and no longer styled) blog about improving CSS performance. When the project went open source, the WebKit team blog was set up, but sadly he doesn't write so much any more.
One important policy they have on WebKit is that nothing is allowed to have an adverse effect on performance: if a change, or a new feature, makes things run slower then it simply can't be committed. This helps to avoid the problem of performance gradually decreasing as new capabilities are added.
For JavaScript, Google created their own scripting engine called V8 which uses a load of clever techniques to optimise execution. It also compiles to native code, rather than an interpreted bytecode, so JS applications can run at pretty much the speed of native code. This has led to a speed war amongst the browser makers: Firefox's TraceMonkey beats V8 on some benchmarks, Safari's Squirrelfish Extreme (which also compiles to native code) claims a 36% improvement over V8, Opera's Carackan (native code compilation again) hasn't quite caught up with WebKit and Chrome yet (though they're working on it), and the IE Team claim that the latest preview of IE9 has overtaken Firefox.
So, to sum up: Chrome is so fast because a bunch of smart people at Apple and Google worked really hard to make it as fast as possible, this has got the smart people working on other browsers also working really hard to try and beat it, and IE9 will be a vast improvement on IE8
Oh, and don't forget Google's Chrome comic book, which explains a lot of the internals
Leave a comment:
-
Originally posted by Sysman View PostHands up everyone who really uses all the features of a given browser. I know I don't.
Originally posted by VectraMan View PostI think it's only fast if you're impressed by the application starting quickly. In use, the different browsers seem much the same to me.
Originally posted by stek View PostMore that IE8 is a POS.Last edited by d000hg; 31 May 2010, 14:37.
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Is an unpaid umbrella company required to pay contractors? Yesterday 09:28
- The truth of umbrella company regulation is being misconstrued Nov 25 09:23
- Labour’s plan to regulate umbrella companies: a closer look Nov 21 09:24
- When HMRC misses an FTT deadline but still wins another CJRS case Nov 20 09:20
- How 15% employer NICs will sting the umbrella company market Nov 19 09:16
- Contracting Awards 2024 hails 19 firms as best of the best Nov 18 09:13
- How to answer at interview, ‘What’s your greatest weakness?’ Nov 14 09:59
- Business Asset Disposal Relief changes in April 2025: Q&A Nov 13 09:37
- How debt transfer rules will hit umbrella companies in 2026 Nov 12 09:28
- IT contractor demand floundering despite Autumn Budget 2024 Nov 11 09:30
Leave a comment: