GlimmerLabs / MathOverImages

A language and ecosystems for doing math over abstract images.
GNU Lesser General Public License v3.0
4 stars 3 forks source link

routes.js is inefficient #8

Closed rebelsky closed 10 years ago

rebelsky commented 10 years ago

We load a lot of libraries that we only use in certain cases. I don't know how require works, but wouldn't it be better to only require a library in the case in which we use that library?

alexthemitchell commented 10 years ago

Probably.

ahinchman1 commented 10 years ago

Hi Sam,

Are you talking about these libraries in routes.js?

// +--------------------------------+-------------------------------- // | Application-Specific Libraries | // +--------------------------------+ var index = require("../functions/index.js"); var gallery = require("../functions/gallery.js"); var albums = require("../functions/albums.js"); var albumContents = require("../functions/albumContents.js"); var accountSettings = require ("../functions/accountSettings.js"); var functions = require("../functions/functions.js"); var username = require("../functions/username.js"); var image = require("../functions/image.js"); var login = require("../functions/login.js"); var signup = require("../functions/signup.js");

All these functions/libraries were on routes.js originally, but they were split up into different files to make routes.js more efficient. The 'require' function is used to load these queries. As far as I know, they're all useful. Could you be more specific about exactly what you wanted cleared?

Thanks, Amanda


From: Samuel A.Rebelsky [notifications@github.com] Sent: Monday, June 23, 2014 9:26 PM To: GlimmerLabs/MathOverImages Subject: [MathOverImages] routes.js is inefficient (#8)

We load a lot of libraries that we only use in certain cases. I don't know how require works, but wouldn't it be better to only require a library in the case in which we use that library?

— Reply to this email directly or view it on GitHubhttps://github.com/GlimmerLabs/MathOverImages/issues/8.

rebelsky commented 10 years ago

Yup. I'm referring to those. For example, if we're loading the gallery page, we don't need albums.js. Similarly, if we're loading the functions page, we don't need gallery.js.

I don't know whether the server loads the files once, or once per request or, …. If it's once per request, we're spending a lot of time loading files we don't need.

We could do some investigating to see how many times things are loaded. If they are loaded multiple times, we should move the require commands to the portions of routes.js that needs them.

-- SamR

On Jun 26, 2014, at 10:22 AM, ahinchman1 notifications@github.com wrote:

Hi Sam,

Are you talking about these libraries in routes.js?

// +--------------------------------+-------------------------------- // | Application-Specific Libraries | // +--------------------------------+ var index = require("../functions/index.js"); var gallery = require("../functions/gallery.js"); var albums = require("../functions/albums.js"); var albumContents = require("../functions/albumContents.js"); var accountSettings = require ("../functions/accountSettings.js"); var functions = require("../functions/functions.js"); var username = require("../functions/username.js"); var image = require("../functions/image.js"); var login = require("../functions/login.js"); var signup = require("../functions/signup.js");

All these functions/libraries were on routes.js originally, but they were split up into different files to make routes.js more efficient. The 'require' function is used to load these queries. As far as I know, they're all useful. Could you be more specific about exactly what you wanted cleared?

Thanks, Amanda


From: Samuel A.Rebelsky [notifications@github.com] Sent: Monday, June 23, 2014 9:26 PM To: GlimmerLabs/MathOverImages Subject: [MathOverImages] routes.js is inefficient (#8)

We load a lot of libraries that we only use in certain cases. I don't know how require works, but wouldn't it be better to only require a library in the case in which we use that library?

— Reply to this email directly or view it on GitHubhttps://github.com/GlimmerLabs/MathOverImages/issues/8. — Reply to this email directly or view it on GitHub.

alexthemitchell commented 10 years ago

Fixed in 3b794d98c4c1c4f5c32fd995ce6b5a217cb24c53