Comments (15)
Did some measurements again (apparently missed an option last time). It looks to me like all the time really is consumed by yaml_rust
, which is quite disappointing, tbh.
But maybe it's something you cannot get around with yaml: it's possible that, given a document consisting of a sequence in block representation, a parser has to perform an (expensive) look-ahaed over the entire file in order to ensure that it really is the root element (and the sequence is not, for example, the key of a mapping). However, I did not perform a thorough analysis.
Since this appears to be an issue of the yaml-dependency rather than something that can be fixed in rustbreak
, this issue should be closed imo (as "wont fix").
from rustbreak.
Heya! Thanks for asking that, to be honest I don't know.
How complicated is your Yaml file? How quick is your Disk? Is it in RAM? There are so many possible causes for the slowness that I am not sure what could be going on.
from rustbreak.
@TheNeikos Im saving in a file. Disk not SDD. Yes it's complicated.
from rustbreak.
Maybe try gather some data using perf
or a similar tool?
from rustbreak.
@neithernut I dont have time and resource to do such advanced tests at the moment.
from rustbreak.
I would not consider "using a profiler" advanced. However, if you can't do measurements yourself, maybe you can provide some more data. Is is possible for you to share the file you try to load? If not, can you give some hints regarding the structure (e.g. maximum/median nesting, number of entities per level)?
from rustbreak.
@neithernut will share when get to my work pc.
from rustbreak.
Have you considered switching the format to bincode, it will be read much faster..
from rustbreak.
@Boscop will try at some point, as u pointed it out!
@neithernut im sorry but my large Yaml us gone. As I did a logic workaround and made it smaller.. and it was in gitignore of the project, so :/. What I remember is that it had a huge Array inside Vec<u8>
from rustbreak.
Ok. Maybe I'll find some time to try to reproduce the issue over the weekend.
from rustbreak.
I've managed to "reproduce" the issue with the following reproducer:
extern crate rustbreak;
use std::env;
use std::fs::OpenOptions;
fn dummy_vec(mut len: usize) -> Vec<usize> {
let mut res = Vec::new();
while len > 0 {
res.push(len);
len = len - 1;
}
res
}
fn main() {
let mut args = env::args().skip(1);
let file = args.next().map(|p| OpenOptions::new().read(true).write(true).create(true).open(p)).unwrap().unwrap();
let db = rustbreak::FileDatabase::<Vec<usize>, rustbreak::deser::Yaml>::from_file(file, Default::default()).unwrap();
if let Some(numstr) = args.next() {
db.put_data(dummy_vec(numstr.parse().unwrap()), true).unwrap();
db.save().unwrap();
} else {
db.load().unwrap();
}
}
I did not manage to get pointers out of perf, yet. I'll have a closer look in the near future.
from rustbreak.
@neithernut maybe u can complain in yaml_rust
and see what they explain?
from rustbreak.
As I already expressed, it might be a problem which is inherent to yaml-parsers. I can investigate in the near future, but I doubt it's something which yaml_rust
can fix.
You are really better of using another format.
from rustbreak.
@neithernut ok tnx.
from rustbreak.
Thank you @neithernut for taking a look into this!
from rustbreak.
Related Issues (20)
- Missing detailed information from the back-end HOT 2
- Errors with newest stable Rust HOT 5
- Problems with Ron and json Value integers HOT 6
- [FR] we should be able to minify the output HOT 6
- Bincode not loading in v2 rc3 HOT 14
- Database::try_read() HOT 2
- FileBackend::from_file / Database::from_file docs missing: Does it load()? HOT 2
- Loading database with empty File fails HOT 18
- Update RON HOT 1
- Transition to Rust edition 2018
- Use `data.read()` instead of `data.write()` in `save()` HOT 1
- Describing generic database HOT 6
- Run `cargo fmt` HOT 1
- More checks in CI HOT 3
- UB with yaml DeSer HOT 5
- RUSTSEC-2020-0077: memmap is unmaintained
- Out of memory if file size > memory size HOT 1
- support speedy https://docs.rs/speedy/ HOT 1
- wasm support + wasi support
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 rustbreak.