Jean Privat [Thu, 21 Jan 2016 01:19:34 +0000 (20:19 -0500)]
Merge: gamnit keys: simple service to keep track of pressed keys
This simple service can be incredibly useful in games where a key held down causes an event at each frame, like walking forward by pressing `w`.
I use this in the 3D version of Tinks! Which should be ready for a PR in a near future.
Pull-Request: #1922
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 5 Oct 2015 14:03:38 +0000 (10:03 -0400)]
lib/gamnit: intro `keys` to keep track of pressed keys
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 19 Jan 2016 14:04:28 +0000 (09:04 -0500)]
Merge: Intro gamnit depth, the 3D game framework for Nit
This PR intro the base structure of a framework for portable 3D game development in Nit.
This framework is based on a list of `Actor`, in `app::actors`, which are drawn at each frame. Each actor is composed of a model and other information specific to this instance: position in the world, rotation and scaling. Each `Model` is either a composite of models or it is composed of a `Mesh` defining its geometry and a `Material` defining how to draw the model. `Material` can be subclassed to use custom shaders. These main classes are defined in the module `depth_core`.
_gamnit depth_ is built upon _app.nit_ and it works well with _gamnit flat_ (renamed from _gamnit simple_2d_). Clients are portable across GNU/Linux and Android, and _gamnit flat_ can still be used for UI elements.
This framework is far from complete at this point, however it designed for extensibility.
Here's a list of _gamnit depth_ implemented features and todo:
### Mesh
- [x] Create 3D simple meshes: cube, plane and UVSphere.
- [ ] Create simple debug meshes: axis arrows, etc.
### Material
- [x] Simple material with uniform ambient, diffuse and specular colors
- [x] Normals visualization materials
- [ ] Depth material
- [x] Texture material with ambient and diffuse lighting
- [ ] Texture material with specular lighting (implement Blinn Phong in GLSL, most attributes are already present)
- [ ] Texture material with normals mapping
### Models
- [x] Load models from .obj and .mtl files.
- [ ] Load models from a binary model format
- [x] Fallback on a simple material and mesh on load errors
### Sample programs
- [x] Sample minimal graphics-only application: model_viewer
- [ ] Merge the globe example with model_viewer
- [ ] Simple client game (like Asteronits for `gamnit::flat`)
### Other engine features
- [x] Composite pattern to manage simple models (single mesh to single material) and composite models
- [ ] Scene framework with a tree-like structure
- [ ] Particle emitters.
- [ ] Support for multiple light types and instances.
- [ ] Optimized GPU side caching with VBO.
- [ ] Optimized C side caching of models data.
- [ ] VR support (at least Cardboard)
- [ ] Hardware key services.
- [ ] Line-3D model collision (as in simple model selection from mouse click)
### Known bugs
- [ ] TexturedMaterial affects 2D sprites geometry, more data is needed to debug.
Pull-Request: #1920
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Sat, 19 Dec 2015 23:44:39 +0000 (18:44 -0500)]
contrib: intro model viewer
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 17 Jan 2016 16:33:25 +0000 (11:33 -0500)]
contrib/asteronits: fix path to project in metadata descriptions
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 13 Jan 2016 18:02:27 +0000 (13:02 -0500)]
lib/gamnit: intro gamnit depth
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 11 Jan 2016 14:11:18 +0000 (09:11 -0500)]
lib/gamnit: intro `EulerCamera::look_at`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 17 Jan 2016 21:25:35 +0000 (16:25 -0500)]
lib/gamnit flat: set array_enabled settings at each frame
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Jan 2016 04:59:27 +0000 (23:59 -0500)]
lib/gamnit flat: extract `App::frame_core_draw`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 14 Jan 2016 20:35:36 +0000 (15:35 -0500)]
lib/gamnit: rename simple_2d to flat
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Jan 2016 21:25:50 +0000 (16:25 -0500)]
lib/gamnit: add support for map_Ka in the .mtl parser
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 16 Jan 2016 17:14:26 +0000 (12:14 -0500)]
lib/gamnit: move `Texture::checker` to its own class to fix loading
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 16 Jan 2016 17:15:18 +0000 (12:15 -0500)]
lib/gamnit: document `offset` methods
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 14 Jan 2016 20:47:48 +0000 (15:47 -0500)]
Merge: Intro parsers to load 3D models from .obj and .mtl files
Intro parsers to load 3D models from the ASCII based format of .obj and .mtl files. Also as support intro a new kind of asset, `app::TextAsset`, with lazy loading in the style of `Sound` and `Texture`.
Model parsing services will be used by the 3D API of gamnit to load 3D models generated by modeler tools like Blender.
The services in `gamnit::model_parsers` are independent of gamnit. However since they are game related, it is a nice package to classify them in. They still can be used by any other 3D graphics engine, as `gamnit::network` which is also independent but game oriented. This adds a small duplication in their representation because a model is stored differently once loaded in gamnit. But the format in gamnit is so low-level (only arrays of Float) that we need an intermediate representation to triangulate faces and stuff like that.
Services of `model_parser_base` may be moved to other modules in the future as needed. The services added to `StringProcessor`, may be useful to other parsers and thus it could be moved up to `parser_base`. `Vec3` and `Vec4` apply an API similar to `vec3 & vec4` of GLSL. I may move them up to gamnit or glesv2 and add more services to transform from and to points, colors and other float based data vectors.
Pull-Request: #1918
Reviewed-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Tue, 12 Jan 2016 19:00:48 +0000 (14:00 -0500)]
lib/mnit: rename `Asset` to `MnitAsset` to fix conflict with `app::Asset`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 12 Jan 2016 03:52:31 +0000 (22:52 -0500)]
lib/gamnit: intro parsers for .obj and .mtl files
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 19 Dec 2015 15:36:07 +0000 (10:36 -0500)]
lib/gamnit: intro new services and refine `StringProcessor` to read model files
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 14 Jan 2016 14:34:00 +0000 (09:34 -0500)]
Merge: Extend is_numeric to support negative values and scientific notation
Pull-Request: #1917
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 14 Jan 2016 14:33:58 +0000 (09:33 -0500)]
Merge: nitcorn: skip the listening loop when running the tests
Until now, each nitcorn example checked if it was being tested, and if so it would quit to not block jenkins. This PR moves this check in the nitcorn module so it is the default behavior.
This should help for #1915 and future nitcorn programs.
Pull-Request: #1916
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 11 Jan 2016 19:49:11 +0000 (14:49 -0500)]
lib/parser_base: intro `StringProcessor::eof` and fix index error
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 30 Dec 2015 21:26:43 +0000 (16:26 -0500)]
lib/android: implement `TextAsset`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 1 Jan 2016 23:07:26 +0000 (18:07 -0500)]
lib/android: fix manipulation of Java stack from assets_and_resources
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 12 Jan 2016 05:05:19 +0000 (00:05 -0500)]
lib/linux: implement `TextAsset`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 20 Dec 2015 00:46:05 +0000 (19:46 -0500)]
lib/app: intro `Asset` and `TextAsset`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 20 Dec 2015 14:21:58 +0000 (09:21 -0500)]
lib/core: add a factory to `Set` to instantiate a `HashSet` by default
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 12 Jan 2016 17:17:28 +0000 (12:17 -0500)]
tests: update test_string_is_numeric
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 12 Jan 2016 04:00:59 +0000 (23:00 -0500)]
lib/core: remove support for ',' in `is_numeric`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 29 Dec 2015 18:51:27 +0000 (13:51 -0500)]
lib/core: `is_numeric` returns false on empty strings
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 19 Dec 2015 16:36:30 +0000 (11:36 -0500)]
lib/core: extend is_numeric to support negatives (!) and e notation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 6 Jan 2016 18:56:49 +0000 (13:56 -0500)]
lib/nitcorn: update examples as they don't need to check for tests
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 6 Jan 2016 18:54:46 +0000 (13:54 -0500)]
lib/nitcorn: skip the listening loop when running continuous integration tests
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 29 Dec 2015 14:12:34 +0000 (09:12 -0500)]
Merge: String block optimisations
This stack of commits is a batch of brand-new optimisations on `String`, especially regarding the manipulation of UTF-8 characters.
As a baseline, last Tuesday @privat tried the JSON parser on a 30MiB json file, the execution took approximately 10 seconds for ~38 GIr with Valgrind, now and with his Nitcc upgrades, the total runtime is less than 2 seconds for ~11 GIr with Valgrind.
Pull-Request: #1885
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Lucas Bajolet [Tue, 29 Dec 2015 04:42:02 +0000 (23:42 -0500)]
src: Improve speed of interpreter when working with Strings
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 14 Dec 2015 15:33:34 +0000 (10:33 -0500)]
lib: Fixed text_stat with improvements from lib
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:26:36 +0000 (13:26 -0500)]
lib/core: Avoid boxing when comparing two NativeString instances
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:24:17 +0000 (13:24 -0500)]
lib/core: Improve speed of `utf8_length` in NativeString and change signature
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:22:51 +0000 (13:22 -0500)]
lib/core: Perfize `substring` in `FlatString`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:22:20 +0000 (13:22 -0500)]
lib/core: Have `is_empty` work with `_bytelen` instead of `length` for speed
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:20:43 +0000 (13:20 -0500)]
lib/core: Added shortcut for common ASCII-case in `find_beginning_of_char_at`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 7 Dec 2015 18:07:53 +0000 (13:07 -0500)]
lib/core: Improved cache mechanism in `ropes` for `substring` and `[]`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:29:20 +0000 (13:29 -0500)]
lib/core: Improve speed of an indexed access in a UTF-8 `Text` entity
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:17:01 +0000 (13:17 -0500)]
lib/core: Added `to_s_unsafe` method to `NativeString` which does not cleans a `NativeString` before returning it as a `String`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Fri, 18 Dec 2015 20:40:47 +0000 (15:40 -0500)]
lib/core: Improved the speed of `clean_utf8`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 18:12:05 +0000 (13:12 -0500)]
lib/core: Added prefetching of 4 chars at once on `NativeString`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Mon, 28 Dec 2015 21:21:57 +0000 (16:21 -0500)]
Merge: expanded the nit_env.sh script to register nit within .bash_profile and .bashrc
When running `source misc/nit_env.sh install` I noticed that it resulted in the following error:
`grep: User/user .profile: No such file or directory`
The `nit_env.sh` script created a `.profile` file in the home directory despite an existing `.bash_profile`. The `nit` command won't work since the shell will read the `.bash_profile` instead of the `profile`.
This PR checks for the existance and writes to a `.profile` or `.bashrc` or `.bash_profile`, if it finds none of those it creates a `.profile` and writes to that one.
If the PR is accepted the documentation will have to be updated.
Pull-Request: #1913
Reviewed-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Mon, 7 Dec 2015 18:04:54 +0000 (13:04 -0500)]
lib/core: Re-made `length` an attribute in `FlatString` since its cost as lazy was prohibitive
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 8 Dec 2015 15:09:29 +0000 (10:09 -0500)]
lib/core: Removed `last_byte` attribute in `FlatString` as it is useless
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
itsWill [Fri, 25 Dec 2015 18:30:57 +0000 (19:30 +0100)]
expanded the nit_env.sh script to register nit within .bash_profile, .bashrc
Signed-off-by: itsWill <guilhermerpmansur@gmail.com>
Jean Privat [Tue, 22 Dec 2015 14:13:38 +0000 (09:13 -0500)]
Merge: model: migrate model_collect to model_views
And update all the clients.
Pull-Request: #1908
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 19 Dec 2015 12:27:24 +0000 (07:27 -0500)]
Merge: src: introduce Nit Static Analysis Framework
This is the first step in the introduction of a static analsysis framework for the nit language.
This PR introduces the basic behaviors of a StaticAnalysis and ForwardAnalysis.
I added ReachingDefAnalysis as an example of StaticAnalysis implementation.
I also added `nitsaf`, a client example for the saf module.
I suggest to read this PR commit by commit, I splat it in steps:
* introduce base services
* handle ifs constructs
* handle loops constructs
* handle method declaration
Next steps/PRs will be:
* introduce inter-procedural analysis
* use RTA for better inter-procedural analysis precision
* backward analysis
* add more analysis (isset checks, attr isset, unused properties, useless nullables...)
Closes #511.
Pull-Request: #1764
Reviewed-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Sat, 19 Dec 2015 08:44:50 +0000 (03:44 -0500)]
tests: skip nitsaf with niti and nitvm
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 19 Dec 2015 08:44:37 +0000 (03:44 -0500)]
nitsaf: add intraprocedural analysis
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 24 Oct 2015 18:02:31 +0000 (14:02 -0400)]
lib/collection: introduce init `HashMap::from`
HashSet has one, why not HashMap?
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 17 Oct 2015 02:40:51 +0000 (22:40 -0400)]
nitsaf: add loop flow set merge
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 17 Oct 2015 02:40:22 +0000 (22:40 -0400)]
nitsaf: add flow merge on `if..else` blocks
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 16 Oct 2015 23:20:18 +0000 (19:20 -0400)]
nitsaf: add tests
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 16 Oct 2015 23:10:27 +0000 (19:10 -0400)]
nitsaf: introduce `nitsaf` binary
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 17 Oct 2015 02:25:41 +0000 (22:25 -0400)]
nitsaf: introduce reaching defs analysis
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 17 Oct 2015 02:39:22 +0000 (22:39 -0400)]
nitsaf: introduce Nit Static Analysis Framework
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Dec 2015 04:41:18 +0000 (23:41 -0500)]
nitx: migrate client to new doc API
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:57:42 +0000 (02:57 -0500)]
nitdoc: migrate client to new doc API
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:56:57 +0000 (02:56 -0500)]
nitdoc: migrate phases to model view
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:42:11 +0000 (02:42 -0500)]
nitdoc: make DocModel a ModelView
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:41:51 +0000 (02:41 -0500)]
doc_base: fix warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:37:51 +0000 (02:37 -0500)]
model: make Model::model behaves like for other mentities
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:28:18 +0000 (02:28 -0500)]
nitmetrics: migrate nullables metrics to model_views
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:28:11 +0000 (02:28 -0500)]
nitmetrics: migrate mendel metrics to model_views
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:28:05 +0000 (02:28 -0500)]
nitmetrics: migrate mclasses metrics to model_views
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:05:32 +0000 (02:05 -0500)]
autocomplete: use model views
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 05:54:12 +0000 (00:54 -0500)]
nituml: use ModelView
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 03:07:10 +0000 (22:07 -0500)]
nitweb: use ModelTreeVisitor instead of custom tree list
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Dec 2015 03:03:58 +0000 (22:03 -0500)]
nitweb: use MEntityTree instead of ad-hoc list
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 00:35:05 +0000 (19:35 -0500)]
nitweb: use ModelView instead of model collect
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 00:29:30 +0000 (19:29 -0500)]
nitweb: introduce ModelAction
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 00:02:46 +0000 (19:02 -0500)]
nitweb: remove dependencies from `model_html` to `model_collect`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 07:05:19 +0000 (02:05 -0500)]
model_collect: use model_views
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Fri, 18 Dec 2015 20:27:41 +0000 (15:27 -0500)]
Merge: Faster hex parsing
As said in #1895, we need faster parsing of UTF-16 escaping sequences, this PR is the answer.
It makes the runtime of the `large_escaped` benchmark go down from ~5s to ~3.5s, and with valgrind, from 26GIr to 20GIr
Note: based on #1886, only the 4 last commits are of interest here
Pull-Request: #1896
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 20:27:37 +0000 (15:27 -0500)]
Merge: core: add Text::levenshtein_distance
Pull-Request: #1912
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Fri, 18 Dec 2015 20:27:32 +0000 (15:27 -0500)]
Merge: Better mmodule location
This mainly close a undocumented issue where `mmodule.location.source` is wrong
Pull-Request: #1911
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Fri, 18 Dec 2015 20:27:28 +0000 (15:27 -0500)]
Merge: hightlight: correctly highlight loose comments
close #1907
Pull-Request: #1910
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Fri, 18 Dec 2015 20:27:25 +0000 (15:27 -0500)]
Merge: readme: add information section
Pull-Request: #1909
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Fri, 18 Dec 2015 18:41:52 +0000 (13:41 -0500)]
lib/core: Added an optimized `to_hex` function to `FlatText`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Fri, 18 Dec 2015 16:00:02 +0000 (11:00 -0500)]
tests: update nitx sav because more information
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 15:59:40 +0000 (10:59 -0500)]
nitc: use mmodule.filepath at some place
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 15:47:55 +0000 (10:47 -0500)]
model: promote MModule::filename to model::mmodule
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 15:47:22 +0000 (10:47 -0500)]
loader: update the mmodule location once the source is parsed
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 17:44:50 +0000 (12:44 -0500)]
core: add Text::levenshtein_distance
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 14:40:27 +0000 (09:40 -0500)]
hightlight: correctly highlight loose comments
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 13:57:14 +0000 (08:57 -0500)]
readme: add information section
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 13:53:23 +0000 (08:53 -0500)]
Merge: model: Beefup model visitor
Add usefull services to model visitor and introduce a model view based on it.
Pull-Request: #1903
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 18 Dec 2015 13:53:18 +0000 (08:53 -0500)]
Merge: Json benchmark
Added a JSON parser benchmark between different languages and Nit using 3 variants:
* Nit/NitCC: The old parser relying on NitCC, which is slow and memory-consuming (more than 6 Gio RAM for the 100Mio escaping-intensive file)
* Nit/Ad-hoc UTF-8 no ropes: The new parser working exclusively on `FlatString`
* Nit/Ad-hoc UTF-8 with ropes: The new parser with a mix of `Concat` and `FlatString`
![vr5fa](https://cloud.githubusercontent.com/assets/1444825/
11787549/
4375a4e6-a25a-11e5-87b3-
ac4346dee3bd.jpg)
I hear you all clamouring, well, here are the results (after #1885 and #1887, naturally):
![output](https://cloud.githubusercontent.com/assets/1444825/
11787622/
b24c0c98-a25a-11e5-8cff-
0e0afe03c9d8.png)
So yeah, I guess we could do better when it comes to escaping since the biggest difference in runtime is in the `large_escape` benchmark which coincidentally contains mostly `\uXXXX` characters.
Other than that, we do as well as Go and better than Ruby (also worse than Python, but this does not count), which is nice.
About the inputs:
* large_escaped is an unusual file since it contains large strings with lots of unicode escaping sequences which should highlight the handling of String-to-Int conversions and Unicode-escape-sequences-to-UTF-8-characters, and it is big, as in very big (94.7 Mio)
* magic, a normally-formatted 54 Mio JSON file with quite a bunch of Unicode characters
* gov_data, a 6.9 Mio JSON file with ASCII characters only
* twitter, a 64 kio JSON file with a lot of japanese characters
I might add some more files later to better represent the variety of inputs, but right now is a good time to push the benchmark suite, enjoy !
Note: Since the ad-hoc JSON parser is benched, #1886 will need to be merged prior to this one if the bench is to work on your machines
Pull-Request: #1895
Reviewed-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Fri, 18 Dec 2015 05:13:10 +0000 (00:13 -0500)]
tests: update tests for model_visitor
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 15 Dec 2015 23:22:55 +0000 (18:22 -0500)]
model_view: introduce views to model based on model visitor
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Dec 2015 03:03:37 +0000 (22:03 -0500)]
model: introduce MEntityTree
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 16 Dec 2015 02:09:20 +0000 (21:09 -0500)]
model: beef up ModelVisitor
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Lucas Bajolet [Tue, 15 Dec 2015 16:51:28 +0000 (11:51 -0500)]
contrib/pep8analysis: Fix operand check in hexdigit
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 15 Dec 2015 16:26:30 +0000 (11:26 -0500)]
lib/json: Improved performance of Unicode-escaping in a `Text`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 14 Dec 2015 22:31:53 +0000 (17:31 -0500)]
lib: Perfized `to_hex` and have it work anywhere in a `Text`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 14 Dec 2015 22:31:16 +0000 (17:31 -0500)]
lib: Added `is_surrogate` service to `Char`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 14 Dec 2015 22:30:58 +0000 (17:30 -0500)]
lib: Added `from_hex` service to transform an hexadecimal digit to an `Int`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>