Comments (10)
Packages now default to having all packages added. You can remove packages as wanted.
If you want to have more than one package config, just import env more than once and configure as you would like.
from anko.
Also note, you can use the Go build flag appengine
which will remove some of the packages, like net and net/http, from being adding by default.
from anko.
Line 515 in 5f413ab
The import function in the VM uses a "global" variable.
Line 32 in 5f413ab
As far as I know, this global variable is shared among all VMs.
If you change it, you change it for everybody. (and you also get multi-threading issues (as they all use the same global variable, and no mutex protect it))
from anko.
If you import env twice, there will be two env, each with there own Packages varable.
from anko.
so let's do something a bit exagerated:
Let say I have 100 customers, and they all have different configs (packages allowed)
I would have to import manually the "env" a hundred times, and manually configure the packages with all possible combinations ?
from anko.
I get your point, it is not as flexible as before, however, do you understand why this change was made? How env is copied in the VMs and the resource load a VM copy was taking for most use cases?
from anko.
tbh, I don't really know why the change was made. I didn't find any explanations (other than "Simplified packages") in the commit.
This is just something I realized while trying to upgrade the lib in my app.
from anko.
Welcome to ask questions :)
from anko.
I'm curious now !
I guess that loading the packages in the VM was taking more memory than not loading them.
Do you have any benchmark / order of magnitude ? like how much ram it takes to load "math" package for example ?
(I'm genuinely curious. I know I could do the benchmark myself, I'm just curious if you have any numbers at hand)
from anko.
The PR that commit was in had a lot going on. Performance was just a small part of it and not really the main focus. One of the main goals was splitting out env to make things cleaner, especially for testing.
I do not have any benchmarks. Every time a new env was created, all the defines had to be run again. If you had a lot of VMs, this would have taken up a lot of space.
So can you close this issue?
from anko.
Related Issues (20)
- panic in LetsStmt HOT 11
- Execute function instead of whole script HOT 6
- Master branch doesn't follow releases HOT 14
- goroutine crash silently HOT 14
- Cannot use vm in multiple goroutines HOT 3
- Method overriding in custom structs HOT 11
- unknown field 'Structs' in struct literal of type ast.TypeStruct HOT 9
- Anon calls doesn't report the expr position HOT 4
- Could I throw an error in script for anko to catch and return it to caller HOT 7
- Crashed by invalid input
- question: extending slices and getting data out HOT 1
- Can a function be created
- when "new" and "make" structure, field will not be zero value.
- Playground (http://play-anko.appspot.com/) returns 500 HOT 5
- undefined symbol 'Atoi' HOT 1
- Methods definition
- How can I get the result HOT 5
- How to check if a channel is closed? HOT 1
- Data race when running scripts concurrently HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anko.