Comments (2)
I think this is already largely covered, just a few notes:
- Speed of the parser is basically a non issue here. Speed has already been (and still is) prioritized so much that the cost of parsing is not a driving force to need to refactor your application.
- A more likely need is to bundle/embed assets not for speed so much as just to have them bundled. There are many different approaches that can be taken for that, and they are already supported. For example I use
rust-embed
to bundle assets. For some of them I embed all locales and parse them all at run time, others select and parse only the necessary locales, and others cache parsed and serialized data. - These crates are fairly low level building blocks, while any specific implementation of asset handling would be a rather higher level thing. Given that most projects probably embed other kinds of assets too, I think it's best to leave this to other crates. In fact there are already quite a few. Besides using other low level building blocks like
rust-embeded
there are much higher level crates likei18n-embeded
that combine both Fluent and embedded building blocks, not to mention several others like it.
If there is something that can be done to make interfaces more ergonomic so that higher level crates can better facilitate this kind of thing we'd be happy to consider it and consider contributions, but I think we can say that directly adding a precompile/embedding system into these crates is out of scope.
from fluent-rs.
Hi, this is largely dependent on your project, but I'd like to stress that Fluent parsing is very fast. You can run cargo bench
on your own but on a regular laptop (cd fluent-bundle; cargo bench
), but here's some back of a napkin calculations:
parsing and resolving 500 messages in a single file takes about 16 microseconds on my laptop.
To put this in a perspective, to achieve 60fps framerate, you need each frame to take less than 16 milliseconds.
You can parse and resolve 500 fluent messages one thousand times each and every frame to deplete this budget.
Now, of course you wouldn't want to do that, but since runtime language change/reload happens very rarely, you are very unlikely to exceed even a single frame budget this way.
You need to look downstream at your stack, what else is involved? Constructing translated UI tree, layout, etc. those also take time. Caching translated UI tree may be a win, at the cost of having to implement cache invalidation etc.
All I'm saying here is that I doubt that even on a very slow mobile phone parsing and resolution of fluent messages costs enough to build infra to avoid. YMMV
from fluent-rs.
Related Issues (20)
- ResourceManager ignores and hides errors
- ResourceManager needs to implement BundleGenerator HOT 2
- Parser swallows leading whitespace after indented placeable HOT 2
- Clippy should be run in CI HOT 2
- rustmt should be run in CI
- error[E0277]: `(dyn Any + 'static)` cannot be sent between threads safely HOT 11
- Cannot use built-in functions HOT 2
- Which data providers Fluent crates use? HOT 3
- Make FluentArgs a trait? HOT 1
- Switching windows process/thread ui languages HOT 2
- Provide Way to Avoid Allocating To Collect Formatting Errors HOT 7
- Using or switching to icu4x crates? HOT 4
- Output looks the same, but is different HOT 3
- Behaviour of FluentArgs::set is misleading HOT 1
- Support full precision of all numbers HOT 1
- How to use this in a command line program and properly parse POSIX locales? HOT 1
- [Feature request] Allow serialize all AST types instead of just Resource HOT 7
- Include source position in the AST HOT 5
- Does a 'safe harbor' release of the current HEAD make sense before further changes? HOT 12
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 fluent-rs.