« first day (1014 days earlier)      last day (3937 days later) » 

11:00 AM
I think he means "copying a block of data in memory"
 
Yeah, me too - I think it's a horrible question.
In a language that runs in a VM, you get no explicit control over that anyway.
You can use heuristics and read the source, and I know how to solve specific performance issues having read relevant parts of - for example - the v8 source when I needed to.
 
well, string concatenation implies two memcopies
 
Do you really think so?
 
@JanDvorak this is totally implementation dependant. And in some cases it could be avoided
 
unless you know you can overwrite one of the arguments
 
11:02 AM
for(var i=0;i<100;i++){
   str+="h";
}
Do you think there are a hundred strings created and destructed here?
 
nope
 
(Like in some other language?)
 
I don't think anything in the EcmaScript norm forbids link chaining or a bigger buffer allocation
 
We can't really tell what improvements new jit with show :)
There are general 'rules of thumb' but that's pretty much it. It's a managed language, discussing memcpy s is silly.
 
link chaining? Is that actually ever used by a JIT for native strings?
 
11:04 AM
@JanDvorak probably not. But what I say is that it's up to the VM implementors to optimize this.
 
Exactly, it's not in your control in the first place.
 
Don't we have languages like js/php so we don't have to think about these things?
 
@Loktar you are in is weekly
 
it'd be cool, however
 
11:05 AM
when you do a char *a = malloc(12*sizeof(char)) in C you have to deal with the way stuff is allocated in memory your self, you copy yourself etc. In JS you simply don't have that level of control.
Honestly? In most cases a 'hot' jit does a damn good job, and is being limited by the weak/dynamic nature of JS more than by memory.
 
var a = Array(12)
 
This is why C# and Java have some very fast implementations (unlike 10 years ago)
@JanDvorak Does that actually allocate memory?
 
What disturbs me most in this question is that OP heard the word "memcopy" and focuses on this. That's not how he should approach performance problems. I would have no problem discussing memcopy with somebody who understands the topic.
 
@BenjaminGruenbaum it's up to the implementation, but yeah, it should allocate exactly even if lazily.
 
@JanDvorak Does that use a low level sequential memory block? Does it create a linked list?
 
11:07 AM
Hello, everybody!
 
Why should it allocate anything ?
Hello @Alnitak
 
His friend is probably some C programmer who's just gone mental because he lost his precious free
 
@BenjaminGruenbaum I'd expect a single block of the exact size or rounded up nicely
 
@JanDvorak Maybe, maybe not, that's very dependent on what you're actually doing.
@IvoWetzel Happy birthday, have a great year :)
 
@BenjaminGruenbaum if I do Array(1024) and fill it with 1024 arrays, I'd expect to have a contiguous block of 1024 pointers in-memory
 
11:09 AM
0
A: Memcopies in JavaScript?

Ivo WetzelToday's JavaScript engines are all JIT based, there's no real way you could even influence such low level operations, depending on the exact way the engine implements a given operation, you don't even know what exactly is going on anyway. Besides that, your wonderful optimization from today coul...

btw
@JanDvorak That's a very bold assumption.
 
or better yet, a single contiguous block of 1024x768x3 floats
 
@JanDvorak But the point is...the implementation can do whatever it wants. It can take up 1024 mb and use it to download porn into your RAM.
 
@Zirak are you sure the JIT is allowed to make extra XHRequests?
 
Yes, there is nothing preventing it from doing so other than common sense.
 
you will of course have to register a callback to actually be able to see the porn
 
11:11 AM
@JanDvorak What's going the stop it? The government!? They're into it as well!
 
anyone familiar with high charts?
 
@JanDvorak It's curious to write bold like this. How to you write italic ?
 
italic
 
They're using js JITs to download illegal porn so you'd be thrown into jail for speaking out against them.
 
@JanDvorak You're right in that it is very predictable, but you can't really assume anything about the way memory is handled. You can optimize 'for v8' for example but you can't 'optimize JavaScript code'.
Well, you can, but not in the way it allocates memory.
 
11:13 AM
@Zirak That's easy to fix though. function free() { };
 
but, I can tell the JIT I want to store 1024 elements
 
How can wordpress be that popular with so few Developers Friendly things ?
 
There, now he has a free function.
 
That's just...
 
@dievardump It's developer friendly compared to other stuff.
 
11:14 AM
@BenjaminGruenbaum Compared to assembly?
 
@OctavianDamiean compared to malebolge and maybe intercal
 
I remember having less problems to find how to do things with Joomla 7 years ago than finding how to get the uploaded size of an image attach to a post in wordpress nowadays
 
*fewer
 
Can somebody familiar with V8 source point me towards to implementation of arrays (or specifically the splice function) ?
 
@dievardump Oh god no ... Joomla is even worse.
 
11:16 AM
@dystroy sure, fast splice or simple splice?
 
@dystroy it uses a backing array and a start-pointer it increments when you shift out an element. Not sure how it does splice, however.
 
ninja'd
 
welp, this is pretty crappy. Warranty for my headphones expired 4 days ago, and I ran over the cable one time too many now...
 
11:17 AM
not that a warranty would cover accidental damage...
 
@Zirak What headphones?
 
@BenjaminGruenbaum thanks
 
@Alnitak If I said I ran over them intentionally?
@BenjaminGruenbaum AKG K518
 
Right, you already told me that sometime.
 
11:19 AM
would you lot mind running some more tests on this benchmark - jsperf.com/looping-operators ?
 
I started getting headphones that have exchangable plugs
 
please
 
@Alnitak what browsers do you need?
 
anything you like. There's no opera results yet
 
@Zirak :(
 
11:20 AM
@Alnitak I don't really like loop benchmarks :P
 
@Alnitak += is somewhat faster in Chrome
 
9
A: Which is fastest: $.each, .ForEach, for-loop or something else?

Benjamin GruenbaumProbably the native for loop (well, everywhere except opera, where foreach is faster but that's another story). However it really doesn't matter in 99.9% of cases. Always prefer readable code over faster code when you can. All of these types of loops can handle hundreds of thousands of iterati...

 
@JanDvorak not on my system it isn't...
 
Not here either, ++ is fastest here
 
so there's a lot of noise
 
11:21 AM
++i is faster in IE too
 
++i feels backwards
 
If it were C++ I'd worry about the difference between ++i and i++
 
@OctavianDamiean I know, they rock
 
Let's try IE11
 
Well, since it's just exchanging the plug...eh, I'll talk to them
 
11:22 AM
@Zirak but ... but you killed them.
 
JavaScript Weekly: again, @Loktar's DOOM effect
3
 
@OctavianDamiean It was a chain of accidents! Due to the placement of my computer, the wire sometimes droops too close to the chair's wheels, and when I go too much to the left, I run over the wire
 
@Zirak Do you already know when you'll be in Venice?
 
@OctavianDamiean In about 2 months
 
11:24 AM
So end of September.
 
the bench mark isn't that important, but I did want to prove wrong some tw*t who claimed that i += 1 would work faster then i++ in a for loop :)
 
Cool, cool cool cool.
 
21/9 is the concert, if I want to stay another day in Paris, and then in Lyon...I think I'll be around the 24th or something.
Depends if I'll be able to be in Milan or not
 
and interestingly it seems that NCZ's recommendation to use while (i--) instead of a for is wrong for most browsers, too
 
@Alnitak Where?
 
11:24 AM
@Zirak What would hinder you?
 
@Zirak do you speak french ?
 
@OctavianDamiean Budget restraints. Italy's highlights in this trip are Venice and Rome, I'll see how much money I should have left.
 
@jAndy About 10 words
 
11:26 AM
@Alnitak What a dumb answer, he got a -1 from me. Optimizing loops is almost always insignificant, it's only significant when the body of the loop is very short and fast
 
Make sure to visit the Pantheon too when you're in Rome.
 
I hadn't even seen his last comment when I asked for the extra tests just now. Even then he's wrong - I tested three browsers, and the fact it was all on one OS is irrelevant.
 
@BenjaminGruenbaum what are you talking about ? optimizing loops can be a great and important thing for lots of algos
 
@BenjaminGruenbaum it does make sense, however, to replace jQuery loops with native loops in performance-critical sections
 
I visited Rome 4 years ago, but that was for only 4 days. There's soooo much to make up...
 
11:27 AM
talking about things like Duffs device etc.
 
@jAndy Not the loop types
The actual contents of the loops.
 
oh I see
 
@JanDvorak When did it ever matter?
@Zirak Having been in Rome several times, 4 days is enough to see most of Rome.
Then again, the company you visit it with also matters, a trip with your parents or friends is different from a trip alone which is in turn different from a trip with a girlfriend etc.
 
Who was your trip with?
 
Sure. The best way to really visit a town is alone. That's the same for museums of course. Alone without camera.
 
11:30 AM
Depends on the reason you're visiting
 
sex tourism
in ziraks case
 
Hahaha
 
@Alnitak IE11 does the while(i--) faster :P
 
And the best way to really visit a town in Italy is to be in Firenze.
 
@BenjaminGruenbaum Not enough for me
 
11:31 AM
@jAndy Truth is, he just wants to visit okok in Italy
And punch him in the nuts
 
Hahahahaha
 
bunga bunga ?
 
okok is in Torino I think. This is a beautiful town too.
 
Our love cannot be denied any longer
 
@BenjaminGruenbaum Is that the dog slow "other" row in the results?
 
11:33 AM
@Alnitak Yeah, it's a VM
 
ah, ok :)
 
This is my approximate route: maps.google.com/…
 
(Which now runs on 1 gig of ram and a single processor)
 
(only taking trains between cities)
 
@Zirak That sounds swell, the trains there are useful (buses are a lot cheaper though)
 
11:34 AM
so close to the Zirak, yet so far away
:-(
 
heh, I'm actually passing by Torino in Lyon->Milan
okok and @FlorianMargaine are almost neighbours!
 
JOOI, in my answer to that question I've used continue LABEL which I almost never do. Would anyone care to propose any cleaner way of breaking out of that inner loop?
 
@Zirak about about this little side trip
 
:p
 
11:37 AM
@jAndy yyeeaahhhh
 
@Alnitak Don't have a break, use an else?
 
I'll then do a u-turn to America
I also have to visit Nigeria.
 
@BenjaminGruenbaum I'm talking about the inner loop, not the break at the end.
 
Got the nicest offer.
 
in javascript, if I return a Javascript Object as a python dictionary, is there a way to reference each column as a separate list?
 
11:39 AM
How did you mix languages like that?
 
Flask with python
I do a method, it returns a javascript object of a few dictionaries, then I use jQuery's getJSON to put it in my javascript
 
ok, let's go back a bit. What do you have, and what would you like to have?
 
@Zirak Oh dude! You should make a quick stop at Lake Garda!
 
@Alnitak that needs some serious restructuring. You're placing while you don't hit something right?
 
@OctavianDamiean That sounds doable
 
11:43 AM
@Zirak I have a Javascript object represented like this: [["key": [item1, item2]], "key2": [item, item]] etc
 
@OctavianDamiean So many tourists in lake Guarda... And it's not for constained budgets, especially in augusta
 
@Crowz That's invalid. [] stands for ordered lists, key value pairs use {} (like dicts in python)
 
@dystroy He is a tourist! :)
 
I was told that the end of September is somewhat of a tourist season...which doesn't seem very likely
 
@BenjaminGruenbaum I just copied it from my method, the whole object is enclosed in {...} though
 
11:44 AM
People in lake guarda only speak Deutsch. Even the Italians here adress to you in german, because it's the main language here
 
@Crowz still invalid JS
 
Besides buying tickets and tapas/pizza, what use is there talking?
 
@BenjaminGruenbaum hmm. well, the keys actually have commas after them, if that's significant
they're keys in the python representation at least
 
I should move to lake Guarda then
 
@Crowz Log your object in the js side, so we'd be on even grounds
 
11:45 AM
@Zirak In good restaurants (not the ones who sell tapas and pizza) I'm often offered coffees or alcohols in Italia because I speak with people
 
its called GARDASEE
 
@dystroy blegh, coffee and alcohol
 
@jAndy Are you rich ?
 
@dystroy rich of knowledge, that good enough? :P
 
@jAndy Will you be able to show your Porshe of knowledge ? If not, [some] people might spit on you...
 
11:47 AM
@dystroy I thought that was only the case in Monaco
 
Guarda is a little similar. Too small for the number of rich germans who want to spend holidays here or buy a house
 
@Zirak I'm not entirely sure how to do that. This is a JS object, I just did the web call
 
When you get your object, pass it to console.log, and open your console to see it (F12 in any decent browser)
 
FYI: console.log(console) for all the magic
@Zirak (mac user won't love it)
 
@Zirak alas, I am on a mac and F12 does weird things
 
11:53 AM
@dievardump You're awarded 2 internet points
 
Yeaaaaaaaaaah
 
@maxART Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@Crowz Then Ctrl+Shift+J for Chrome and...what was it for FF? Ctrl+Shift+K?
 
Why has connor requested access to the room when I was sleeping?
 
I dunno, google "<browser name> open js console"
 
11:54 AM
I created a dynamic ellipsis code which adds ellipsis on the second line.. but I have a issue in it i.e., when we stretch the size of the page till the ellipsis has gone and then if we shrink the page, the ellipsis is not being added. Here is the fiddle jsfiddle.net/venkateshwar/txcWN/3
 
Did we do gallery stuff when I was sleeping?
 
no
 
The problem is in this line of code:
 if (fx.elElement) {
        o.removeChild(fx.elElement);
    }
 
phonegap sucks
 
Uncaught Error: NotFoundError: DOM Exception 8
 
11:55 AM
Oh, he went all conspiracy and stuff, yeah, @Zirak pinged me about it, lol
 
Got it, it was some weird series of buttons. Anyway, it says "Object". Then it has an array, under that there's an array, under that there's another array
 
@IvoWetzel Happy birthday.
 
@Crowz yeah....we're gonna need more than that to understand what you have
 
@OctavianDamiean Thanks :)
 
12:03 PM
How to check if an element has a specific child element?
I am storing the specific child element in a variable..
pElement.hasChildNode()
^ only checks for whether the element has nodes or not
 
@Mr_Green If you have access to the child, you can do child.parentNode === parent
 
ohh good
 
Alternatively, you can walk over the parent.children list
 
but sometimes my child element is undefined
 
@Zirak what else is to be said about it?
 
12:06 PM
ya that can be done
ok I will try that
thanks
 
@Mr_Green In those cases then we can be pretty sure the parent doesn't contain it
 
yeah
 
@Crowz Everything. What do you have, really? Give us an example (in js). What would you like to have? What's the problem with going from what you have to what you want?
 
@Zirak I'm using high charts, eh? And it seems to mostly accept single length arrays, but I have a python dictionary (with all the information I need). I just want to make each "column" of the python dictionary as a seperate array
 
What's a "column" in a dictionary?
Give us an example!
 
12:09 PM
(key: value1, value2)... I want all the keys as an array, all value1s as an array, etc
 
oh, that's rather simple
!!tell Crowz mdn Object.keys
 
Is it only me or are there way too many tests in the edit review queue ?
 
@BenjaminGruenbaum I was away at lunch. What did you have in mind?
@BenjaminGruenbaum "trial and error" seems like a reasonably good fit for this, since the error rate should be reasonably low.
 
hey there people
 
Can someone do me a small favour? In the introduction/tutorial to this game, when you reach the part about Recruiting (in the "tavern"), can you tell me if you can hire Jacky and Lulu?
 
@Zirak sure.
var app = {
    utils : {
        clean : function( string ) {
            ...
        },
        trim : function( string ) {
            ...
        }
    },
    lightbox : function() {
        var test = app.utils.clean( string );
    }
}
is there an easier way to reference app.utils.clean() from inside app?
 
@Zirak yes
 
@Zirak also yes. 500 gold left over?
 
12:38 PM
Awesome, thanks
 
Damn :
0
Q: Using javascript to create Jquery link

flyersunWe have a dynamic adbanner which is loaded onto websites via Google Double Click. We use some Jquery in the code so as part of the set up we check if a website is running Jquery and if not we use Javascript to add a link to our Jquery file. This is being done fine however I'm still getting an e...

 
posted on July 26, 2013

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} New WEEKLY WEINERSMITH. This episode featuring Zombie Ants. Here's t

 
Poor guys using this adbanner service... this is so shitty...
 
This game is pretty damn horrible, as you can see from the comments, but it has a medium badge. The NPCs are horribly imbalanced, Jacky is super powerful, so I'm commenting on how to coast through the badges.
 
A coworker submitted a bug report to a software vendor last night. He got a response this morning:
> "This has been added as an enhancement"
Yes, he was literally just told "This is not a bug, it's a feature"
 
12:43 PM
and what was the bug ?
 
Did it cause his CPU to overheat?
 
If more than one filter is added to an invoice item column, no items are ever returned.
So, basically, filtering is no longer a viable option for us, and I'm going to have to write code to validate all the selections.
 
How fun
 
Gotta love them features
 
about require.js ... i am confused what if i wanna use history.js
it will just be evaluated in the global scope, right ? and i will get a dirty history variable in global namespace ?
 
12:46 PM
I haz no idea
On a happier note, Shadowrun Returns released yesterday.
 
@RyanKinal artwork looks amazing.
 
It's pretty sweet. I've played 26 minutes, and I'm pretty much hooked.
 
@FlorianMargaine you are the guy with all the modular pattern black magic :->
tell me the mystery :D
 
@Darkyen How about trying and seeing?
 
@Zirak on a cellphone :-(
 
12:51 PM
Bwaaaahahaha
Nerd
 
?
ryan, you sure you are sober mate ?
 
Unfortunately so
 
You're loading 80KB and tens of thousands of JS code for a banner -_-? — Benjamin Gruenbaum 4 secs ago
lol
 
???
 
posted on July 26, 2013 by dutton

Alpha transparency in Chrome video Chrome Canary now supports video alpha transparency in WebM. In other words, Chrome takes the alpha channel into account when playing 'green screen' videos encoded to WebM with an alpha channel. This means you can play videos with transparent backgrounds: over web pages, images or even other videos. There's a demo at simpl.info/videoalpha. This

 
12:54 PM
@rlemon eh?
 
@Feeds oh sweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet
@Loktar ^
 
@Darkyen depends on history.js
many big used libs provide a way to integrate in require.js
 
@FlorianMargaine explain further mate
 
I'm not re-capping the whole thing. Just read about an hours worth of transcript above and below
 
can't find a shim :-(
 
12:57 PM
so that you can take the dependency as just another module and not pollute the global scope
 
i somewhat fell in love with your 'modularize everything' concept :P
 
wth @FlorianMargaine they removed the crossaints again?
 
@Neal You really need to figure out the context for yourself in pings
 
except for jQuery and _3W i dont want any single global variable
 
@Neal dunno, I've stopped caring
 
12:58 PM
@Amaan No...
@FlorianMargaine haha oy
 
@Darkyen jquery can be loaded as a requirejs module and not pollute the global scope
 
@Neal yeah, thinking is for chumps.
 
@Zirak Well I was pings out of context. I have no time to read it...
 
no you were pinged in context, you just need to figure out the context.
 
@FlorianMargaine i am using a cdn ... that would essentially mean to re-load jQuery, making additional jQuery load time (which is infact bigger then the images in my app so far )
 
12:59 PM
@Darkyen no, jquery supports this
 

« first day (1014 days earlier)      last day (3937 days later) »