Commit Graph

216 Commits

Author SHA1 Message Date
rw e11da87a24 gofmt 2015-05-09 16:10:03 -07:00
rw 3dd54424c0 remove remaining allocs during build 2015-05-09 16:07:11 -07:00
rw 5d68493df4 update CheckClash for string accesses 2015-05-09 15:37:13 -07:00
rw d756efbf76 Reduce allocations when reusing a Builder.
Add the function `Reset` to the Builder, which facilitates reuse of the
underlying byte slice.
2015-04-02 19:33:00 -07:00
rw ace7fa8094 Reduce allocations when building strings.
Builder has a new CreateByteString function that writes a
null-terimnated byte slice to the buffer. This results in zero
allocations for writing strings.
2015-04-02 18:22:13 -07:00
rw f02646e357 Remove all string allocations during parsing.
Change the signature for 'string' getters and settings to use byte
slices instead of strings.
2015-04-02 11:56:55 -07:00
rw 0a3a09aaf3 Merge branch 'go-bytevector-getter' of github.com:benharper123/flatbuffers into go-faster 2015-04-02 11:47:17 -07:00
rw 796be3282c Benchmarks for building and parsing 'gold' data.
Identifies alloc-heavy codepaths.
2015-04-02 11:26:00 -07:00
rw 468124fb9b chmod GoTest.sh +x 2015-04-02 11:25:48 -07:00
Ben Harper 8fb6c4f764 Add byte slice accessor to Go code 2015-04-01 16:47:10 +02:00
Wouter van Oortmerssen 75740c1374 Clarified Verifier options.
Change-Id: I04775dedc61f1c448eedb1883182af7b07239797
Tested: on Linux.
2015-03-30 15:38:36 -07:00
Jason Sanmiya e8598950fc Fix Mac ndk-build error on motive, pie_noon, pindrop.
We were looking for 'flatc' in motive/bin/Debug/flatc,
on Mac. It's actually built to flatbuffers/Debug/flatc.

Tested: OS X Yosemite, ndk-r10d. Also tested on Linux.
Change-Id: I9f1ecfe00c5f42fd9b6808b5a5da1c920487a4c2
2015-03-27 09:27:18 -07:00
Wouter van Oortmerssen ca5c9e7496 Unsigned types in Java now return bigger size signed types.
(Java doesn't support unsigned types).

ubyte/ushort return as int
uint returns as long
(all with correct masking)

ulong still returns as long, as before.

Tested: on Linux & Windows.
Bug 17521464

Change-Id: Id6bc8f38fc8c1a2f4e6733c6980dc6b6e322b452
2015-03-23 17:01:33 -07:00
Wouter van Oortmerssen f7818d83d7 Changed C# ByteBuffer to use bit shifts instead of BitConverter
BitConverter was excessively slow since it allocates a byte array
at each access.

Bug: 18702381
Change-Id: I47be9c38e1d04287ba4c10bc369848f3e13a2a2f
Tested: on Windows.
2015-03-13 16:59:29 -07:00
Wouter van Oortmerssen 7ef2fc2517 Regenerated test code + fixed typo in C# FlatBufferBuilder
Change-Id: Ifa6d9459c53ae60b9bf936d9468ec971ee282f14
Tested: on Linux and Windows.
2015-03-13 13:05:28 -07:00
reynolma2 6df9e1c537 Update idl_gen_general.cpp
There is a bug in creating a C# table when it includes a field of type 'BOOL'. The problem is that the generate C# code is as follows:
  "bool SampleValue = 0;"
This will fail to compile, because in C# this fails, it needs to be generated as:
 "bool SampleValue = false;"

The error is in line ~510

Change-Id: I77f6eea0f269b0540dbeb462602fc447cb69237d
2015-03-13 13:05:03 -07:00
Ben Harper 6a0126340a Add CreateByteVector function to Go's builder
This function gets around the inefficiency of populating a [ubyte] vector
byte by byte. Since ubyte vectors are probably the most commonly used type
of generic byte buffer, this seems like a worthwhile thing to create a
fast path for.

Benchmarks show a 6x improvement in throughput on x64.

There is a new test verifying the functionality of the function.

Change-Id: I82e0228ae0f815dd7ea89bf168b8c1925f3ce0d7
2015-03-11 17:27:39 -07:00
Max Galkin 4464405250 Make FuzzTest2 fuzzier.
1. Random table fields are now marked deprecated. The deprecation rate is adjustable, default is ~10% of fields.
2. Vector type previously produced a dummy field, now a trivial ubyte vector is generated instead.
3. The fuzzed "instances" were previously generated with identical data, now they are randomized: I suppose such was the intent from the beginning, just wasn't implemented.

I ran the new test with a few different settings and random seeds (but only on Windows + VS2015), and it always passed.

Change-Id: I2014686b6680aec24049ccda3f6deffe5205a83e
2015-03-11 17:27:39 -07:00
Max Galkin c3807fa39d Fix for VS 2015 stricter warnings about "shadowed" names.
This change renames a few variables to fix the build in VS 2015.

VS 2015 new warnings:
http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx

Change-Id: Ic9c3f75ee717f0125960c813df442ed4fbcceb4a
2015-03-11 17:27:39 -07:00
gregoire-astruc a360958be3 Implementation of a buffer release strategy.
* Tests for Release feature.
* Check vector_downward.buf_ before passing to deallocator.
* Assertions.
* Shared test between unique_ptr and GetBufferPointer()
* Unnecessary using directives.
* Reallocate vector if released on clear operation.
* Use allocator attribute.
* Renamed `Release()` to `ReleaseBufferPointer()`
* For consistency with `GetBufferPointer()`
* Updated documentation for ReleaseBuffer.

Change-Id: I108527778e56ae5127abf9e5b1be6b445ad75cb7
2015-03-11 17:27:38 -07:00
loverszhaokai 432f3f26a4 Added Copyright headers
Change-Id: I106de8985cea572590d49c896b72c54f33e73bd2
2015-03-11 17:27:38 -07:00
Wouter van Oortmerssen 6ccdfff0af Android build script works with pre-releases present.
build_apk.sh assumed pre-releases would be sorted towards the end,
but instead they end up at the front (sort -n) causing the api
selection loop to halt early.

bug: 19213196
Change-Id: I210a18c16e81880229f154c4613f8b97d90ac9bd
tested: on Linux.
2015-03-09 14:04:30 -07:00
Grégoire Astruc 71e97b7123 Fixed C# Table.cs to work with Mono.
Cast to short for mono compatibility.

Change-Id: I568059a21369b895fa52002fa231f7594f0f736c
2015-02-23 15:57:35 -08:00
Alex Ames c243aa4e15 Merge "Added the hash attribute to ints and longs." into ub-games-master 2015-02-17 22:58:04 +00:00
Alex Ames d575321eba Added the hash attribute to ints and longs.
FlatBuffer schema files can now optionally specify a hash attribute that
will allow someone writing json files to enter a string to be hashed
rather than a specific value. The hashing algorithm to use is specified
by the schema.

Currently the only algorithms are fnv1 and fnv1a. There are 32 bit and
64 variatns for each. Additionally, a hashing command line tool was
added so that you can see what a string will hash to without needing to
inspect the flatbuffer binary blob.

Change-Id: I0cb359d0e2dc7d2dc1874b446dc19a17cc77109d
2015-02-17 14:10:18 -08:00
Stefan Eilemann f353fd8864 Fix pointer underrun when allocating large vectors
Change-Id: Ia69fc3098468eb64420215dc1068342ccbbb1ede
2015-02-13 10:35:08 -08:00
Hyungjin Kim c9a840e935 Change nested_root accessor to be const function.
The `<field>_nested_root()` is not viable from const object. (We usually get `const Monster *`.)

Change-Id: I0d0adcb38dd974318608417ee3094c34fb9c480d
2015-02-11 10:54:03 -08:00
Alex Ames 620fe1c5cf Merge "Call $(strip) on parameters so newlines work." into ub-games-master 2015-02-10 00:56:55 +00:00
Alex Ames 69dae32776 Call $(strip) on parameters so newlines work.
Added a call to $(strip) to the parameters of
`flatbuffers_header_build_rules` so that newlines can be used when
passing arguments to it.

Change-Id: Ie2149acebcef91d28ce2cb4bfd204a209b4c4e2f
2015-02-09 15:18:38 -08:00
franramirez688 da0f096ba2 Added biicode support via biicode.conf and CMake/biicode.cmake
Change-Id: Id9750cceaa57aad3c969cf12299aa60f21c29074
2015-02-09 14:57:17 -08:00
Wouter van Oortmerssen 36fe9d539f Merge "Clarified how to create a good pull request." into ub-games-master 2015-02-09 21:56:56 +00:00
Wouter van Oortmerssen 6180b5ac7a Merge "Reset minimum alignment when reusing FlatBufferBuilder" into ub-games-master 2015-02-09 17:16:38 +00:00
Wouter van Oortmerssen 42bfe240e0 Merge "added reuse option for root objects" into ub-games-master 2015-02-09 17:16:19 +00:00
Wouter van Oortmerssen 1fb0f1ef71 Clarified how to create a good pull request.
Updated CONTRIBUTING.md with some tips.

Change-Id: Id377621a98804293837fda25ef0758cf988eea37
2015-02-04 15:50:02 -08:00
Alex Ames 1c8c9438a2 Merge "Added new Android build target and makefile utils." into ub-games-master 2015-02-04 23:49:58 +00:00
Wouter van Oortmerssen 85f64786da Reset minimum alignment when reusing FlatBufferBuilder
Previously, if you were re-using instances of FlatBufferBuilder
and an earlier buffer would use a 64bit item where later ones
do not, you could be wasting space.

Change-Id: Ic8090a38f97ce73194e991ba72bcfae74a7ace9f
Tested: on Linux.
2015-02-04 15:30:47 -08:00
Florian Enner b0910e75e0 added reuse option for root objects
getRootAs..() function now has a second implementation that
accepts an existing object to allow object reuse, much like
all other methods that refer to objects.

Change-Id: Iffef567c903a130761ef7de98867e5465d29a04d
2015-02-04 15:30:07 -08:00
Alex Ames ff1ac8ab5a Added new Android build target and makefile utils.
Previously Android.mk only had a rule for the Flatbuffers test. There
is now an empty module definition so that flatbuffers can be included
as an Android module in other projects.

Additionally, android/jni/include.mk has been added which contains
some utility functions that can be used by projects using Flatbuffers
to generate header build rules and set up dependencies.

A sample project has been added to the samples directory to
demonstrate how to use flatbuffers with Android.

Tested by compiling Android project on Linux.

Change-Id: I25d6da40f6531777b22f7371187e0a2f4e903ad4
2015-02-04 14:39:53 -08:00
pjulien 4d3db99283 Issue #136
The satellite data of the ``ByteBuffer`` cannot be modified in
any way and stay thread safe in the presence of concurrent readers.

This implementation is simple and does introduce an allocation, however
without it multiple readers will quickly and continuously encounter
``IndexOutOfBoundsException`` exceptions.

An alternative, but possibly more controversial, implementation would
be to use ``Unsafe``.  Using ``Unsafe``, it's possible to do an
array copy with a provided buffer index.

Change-Id: I851d4034e753b3be2931ee2249ec2c82dde43135
2015-02-04 13:53:02 -08:00
Florian Enner 72b9501e69 Added force-defaults to Java bindings
Change-Id: I62d10b639112788be3b0f670280bd50ef9fcf094
2015-02-02 14:04:22 -08:00
Florian Enner 9c169083ad Added FlatBufferBuilder reuse
init resets internal variables, but keeps memory that has been allocated
for temporary storage

Change-Id: If2aa7d27de3c2717cf4c82b1e4e4b6732e495cea
2015-02-02 14:02:22 -08:00
Wouter van Oortmerssen 7bebaab69e Added "raw struct" results to benchmark.
Change-Id: I95c550df7019645b02417259522c7049865997cc
Tested: on Windows.
2015-02-02 14:02:21 -08:00
Gabriel Martinez d8117bb8a3 Merge "Add options to print build rule dependencies" into ub-games-master 2015-02-02 17:01:39 +00:00
Gabriel Martinez df4909e5f6 Add options to print build rule dependencies
Tested: on Linux

Bug: 16465909
Change-Id: I2f1a6def13e47716110426b00990c2c625c03251
2015-01-28 11:27:05 -08:00
Wouter van Oortmerssen 79c2d80ed4 Fix for previous Java commit.
optimization would cause vtable fields from previous tables to be written.

Bug: 19046968
Change-Id: I781f7bcbceeaec0b499d4f1e4e5e8a1e750e0707
Tested: on Linux.
2015-01-26 14:12:20 -08:00
Wouter van Oortmerssen 3e1b789d21 Applied Java namespace filename fix to Go.
Bug: 19067493
Change-Id: Ib32fef963306e27834c15e3bbabc60570924c1a9
Tested: on Linux.
2015-01-26 13:45:33 -08:00
Wouter van Oortmerssen cf7135ff58 Reducing garbage produced by Java serializer.
startObject() now only allocates a new vtable array when it needs to grow.

Tested: on Linux.

Change-Id: Idd041605afcb9487a34d63bda067172d797f437a
2015-01-26 13:35:20 -08:00
Wouter van Oortmerssen f60276f54b Fixed flatc not writing Java files without namespace.
If the schema didn't contain a namespace, paths would contain a
leading /, causing files not to be written.

Change-Id: I508772cbf6d18d464ef7d9f8842d0dbff14358a3
Tested: on Linux.
Bug: 19067493
2015-01-26 13:08:44 -08:00
pjulien 2b01247b30 PR for issue #130. Improves the javadoc of ``FlatBufferBuilder``
and marks ``dataStart`` deprecated.

Change-Id: I48409e20948117c5cf17a1bfabecf64b033eab27
2015-01-26 13:08:44 -08:00
Hiroshi Matsunaga 7cf74cb864 cursor_ is not directly represent the hexadecimal
Change-Id: Ibdbd0e2f85284c1443403ed8c43acbd6e9de635f
2015-01-26 13:08:44 -08:00