juju2143 / walrusirc

Alternate client for OmnomIRC
http://codewalr.us/194
GNU General Public License v3.0
1 stars 1 forks source link

Code cleanup #1

Open Eeems opened 9 years ago

Eeems commented 9 years ago

I've noticed a couple places where you do:

var variable = input_text.replace();
variable = variable.replace():
variable = variable.replace():

While this works, it's a little less efficient then just chaining the replaces together, like this:

var variable = input_text.replace()
    .replace()
    .replace();

public/parse.js#L15

I've also noticed a ton of this:

var variable = "some text";
variable += "some more text";
variable += "some more text";

Which can be replaced with something similar to this:

var variable = "some text"+
    "some more text"+
    "some more text";

It should be easy enough to read, plus it also will perform a tiny bit faster due to not having to figure out variable references etc. public/main.js#L21 public/main.js#L37 public/main.js#L53 public/parse.js#96

juju2143 commented 9 years ago

I stole the parser.js code from OmnomIRC as is (well, stole, it's under GPL and it's properly credited), but yeah I should totally clean that code with something more efficient. (Why did I even do that, especially the 2nd point you made o.o)