[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba. Requested reviews: Paul J. Lucas (paul-lucas) For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'src/runtime/csv/csv_impl.cpp' --- src/runtime/csv/csv_impl.cpp 2014-03-01 01:57:00 + +++ src/runtime/csv/csv_impl.cpp 2014-03-06 19:08:12 + @@ -365,7 +365,7 @@ store::Item_t item; vectorstore::Item_t keys_copy, values; setunsigned keys_omit; - zstring value; + zstring *value; bool eol, quoted, swap_keys = false; CsvParseIteratorState *state; @@ -381,7 +381,8 @@ set_options( item, state ); } - while ( state-csv_.next_value( value, eol, quoted ) ) { + while ( state-csv_.next_value( state-value_, eol, quoted ) ) { +value = state-value_; if ( state-keys_.size() values.size() == state-keys_.size() state-extra_name_.empty() ) { // @@ -390,13 +391,13 @@ // throw XQUERY_EXCEPTION( csv::EXTRA_VALUE, -ERROR_PARAMS( value, state-line_no_ ), +ERROR_PARAMS( *value, state-line_no_ ), ERROR_LOC( loc ) ); } item = nullptr; -if ( value.empty() ) { +if ( value-empty() ) { if ( state-keys_.empty() ) { // // Header field names can never be empty. @@ -408,7 +409,7 @@ ); } if ( quoted ) -GENV_ITEMFACTORY-createString( item, value ); +GENV_ITEMFACTORY-createString( item, *value ); else switch ( state-missing_ ) { case missing::error: @@ -421,15 +422,15 @@ break; } } else if ( state-cast_unquoted_ !quoted !state-keys_.empty() ) { - if ( value == T || value == Y ) + if ( *value == T || *value == Y ) GENV_ITEMFACTORY-createBoolean( item, true ); - else if ( value == F || value == N ) + else if ( *value == F || *value == N ) GENV_ITEMFACTORY-createBoolean( item, false ); else { json::token t; -switch ( parse_json( value, t ) ) { +switch ( parse_json( *value, t ) ) { case json::boolean: -GENV_ITEMFACTORY-createBoolean( item, value[0] == 't' ); +GENV_ITEMFACTORY-createBoolean( item, (*value)[0] == 't' ); break; case json::null: GENV_ITEMFACTORY-createJSONNull( item ); @@ -437,24 +438,24 @@ case json::number: switch ( t.get_numeric_type() ) { case json::token::integer: -GENV_ITEMFACTORY-createInteger( item, xs_integer( value ) ); +GENV_ITEMFACTORY-createInteger( item, xs_integer( *value ) ); break; case json::token::decimal: -GENV_ITEMFACTORY-createDecimal( item, xs_decimal( value ) ); +GENV_ITEMFACTORY-createDecimal( item, xs_decimal( *value ) ); break; case json::token::floating_point: -GENV_ITEMFACTORY-createDouble( item, xs_double( value ) ); +GENV_ITEMFACTORY-createDouble( item, xs_double( *value ) ); break; default: ZORBA_ASSERT( false ); } break; default: -GENV_ITEMFACTORY-createString( item, value ); +GENV_ITEMFACTORY-createString( item, *value ); } // switch } // else } else { - GENV_ITEMFACTORY-createString( item, value ); + GENV_ITEMFACTORY-createString( item, *value ); } if ( !item.isNull() ) === modified file 'src/runtime/csv/pregenerated/csv.h' --- src/runtime/csv/pregenerated/csv.h 2014-01-31 21:47:54 + +++ src/runtime/csv/pregenerated/csv.h 2014-03-06 19:08:12 + @@ -57,6 +57,7 @@ missing::type missing_; // bool skip_called_; // zstring string_; // + zstring value_; // CsvParseIteratorState(); === modified file 'src/runtime/spec/csv/csv.xml' --- src/runtime/spec/csv/csv.xml 2014-02-28 01:46:12 + +++ src/runtime/spec/csv/csv.xml 2014-03-06 19:08:12 + @@ -39,6 +39,7 @@ zorba:member type=missing::type name=missing_ defaultValue=missing::null/ zorba:member type=bool name=skip_called_ defaultValue=false/ zorba:member type=zstring name=string_/ +zorba:member type=zstring name=value_/ /zorba:state zorba:method name=count const=true return=bool zorba:param name=result type=store::Item_tamp;/ === modified file 'src/store/naive/simple_item_factory.cpp' --- src/store/naive/simple_item_factory.cpp 2013-09-17 21:12:49 + +++ src/store/naive/simple_item_factory.cpp 2014-03-06 19:08:12 + @@ -2366,19 +2366,20 @@ const std::vectorstore::Item_t names, const std::vectorstore::Item_t values) { + assert( names.size() == values.size() ); + result = new
Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
1. In a couple of cases, now reusing the same zstring so the cost of growing the string is not paid per value. 2. Added a string_appender class that chunks the appending of single characters onto the end of strings to reduce the number of times zstring::append() is called. 3. Improved creating of JSON objects by using iterators rather than operator[]. -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Description changed to: 1. In a couple of cases, now reusing the same zstring so the cost of growing the string is not paid per value. 2. Added a string_appender class that chunks the appending of single characters onto the end of strings to reduce the number of times zstring::append() is called. 3. Improved creating of JSON objects by using iterators rather than operator[]. For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Commit Message changed to: 1. In a couple of cases, now reusing the same zstring so the cost of growing the string is not paid per value. 2. Added a string_appender class that chunks the appending of single characters onto the end of strings to reduce the number of times zstring::append() is called. 3. Improved creating of JSON objects by using iterators rather than operator[]. For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Review: Approve -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue starting for the following merge proposals: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Voting criteria failed for the following merge proposals: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 : Votes: {'Approve': 1} -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Review: Approve -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue result for https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Stage CommitZorba failed. Check console output at http://jenkins.zorba.io:8180/job/CommitZorba/303/console to view the results. -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue starting for the following merge proposals: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue succeeded - proposal merged! -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Status: Approved = Merged For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209760 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Review: Approve -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba. Commit message: Maintaining more state to avoid construction/allocation/destruction of istringstream. Requested reviews: Paul J. Lucas (paul-lucas) For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Maintaining more state to avoid construction/allocation/destruction of istringstream. -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'src/api/mem_streambuf.cpp' --- src/api/mem_streambuf.cpp 2013-12-27 15:11:16 + +++ src/api/mem_streambuf.cpp 2014-03-07 02:12:46 + @@ -17,7 +17,6 @@ #include stdafx.h #include cstring /* for memcpy(3) */ -#include zorba/internal/cxx_util.h #include zorba/util/mem_streambuf.h #include diagnostics/assert.h === modified file 'src/runtime/csv/csv_impl.cpp' --- src/runtime/csv/csv_impl.cpp 2014-03-06 19:06:43 + +++ src/runtime/csv/csv_impl.cpp 2014-03-07 02:12:46 + @@ -157,11 +157,10 @@ return false; } -static json::type parse_json( zstring const s, json::token *ptoken ) { - mem_streambuf buf( (char*)s.data(), s.size() ); - istringstream iss; - iss.ios::rdbuf( buf ); - json::lexer lex( iss ); +static json::type parse_json( zstring const s, csv_parse_json_state state, + json::token *ptoken ) { + state.set_data( s.data(), s.size() ); + json::lexer lex( state.iss_ ); if ( !lex.next( ptoken, false ) ) return json::none; json::token::type const tt = ptoken-get_type(); @@ -221,9 +220,9 @@ state-csv_.set_stream( item-getStream() ); else { item-getStringValue2( state-string_ ); -state-mem_streambuf_.set( state-string_.data(), state-string_.size() ); -state-iss_.ios::rdbuf( state-mem_streambuf_ ); -state-csv_.set_stream( state-iss_ ); +state-input_buf_.set( state-string_.data(), state-string_.size() ); +state-input_iss_.ios::rdbuf( state-input_buf_ ); +state-csv_.set_stream( state-input_iss_ ); } } @@ -428,7 +427,7 @@ GENV_ITEMFACTORY-createBoolean( item, false ); else { json::token t; -switch ( parse_json( *value, t ) ) { +switch ( parse_json( *value, state-parse_json_state_, t ) ) { case json::boolean: GENV_ITEMFACTORY-createBoolean( item, (*value)[0] == 't' ); break; === modified file 'src/runtime/csv/csv_util.h' --- src/runtime/csv/csv_util.h 2013-08-23 00:43:04 + +++ src/runtime/csv/csv_util.h 2014-03-07 02:12:46 + @@ -17,10 +17,32 @@ #ifndef ZORBA_CSV_UTIL_H #define ZORBA_CSV_UTIL_H +// standard +#include sstream + +// Zorba +#include zorba/util/mem_streambuf.h + namespace zorba { /// +struct csv_parse_json_state { + std::istringstream iss_; + + csv_parse_json_state() { +iss_.std::ios::rdbuf( buf_ ); + } + + void set_data( char const *s, size_t size ) { +buf_.set( const_castchar*( s ), size ); +iss_.seekg( 0 ); + } + +private: + mem_streambuf buf_; +}; + namespace missing { enum type { null, === modified file 'src/runtime/csv/pregenerated/csv.h' --- src/runtime/csv/pregenerated/csv.h 2014-03-06 19:06:43 + +++ src/runtime/csv/pregenerated/csv.h 2014-03-07 02:12:46 + @@ -50,11 +50,12 @@ bool cast_unquoted_; // csv_parser csv_; // zstring extra_name_; // - std::istringstream iss_; // + mem_streambuf input_buf_; // + std::istringstream input_iss_; // std::vectorstore::Item_t keys_; // unsigned line_no_; // - mem_streambuf mem_streambuf_; // missing::type missing_; // + csv_parse_json_state parse_json_state_; // bool skip_called_; // zstring string_; // zstring value_; // === modified file 'src/runtime/spec/csv/csv.xml' --- src/runtime/spec/csv/csv.xml 2014-03-06 19:06:43 + +++ src/runtime/spec/csv/csv.xml 2014-03-07 02:12:46 + @@ -32,11 +32,12 @@ zorba:member type=bool name=cast_unquoted_ defaultValue=true/ zorba:member type=csv_parser name=csv_/ zorba:member type=zstring name=extra_name_/ -zorba:member type=std::istringstream name=iss_/ +zorba:member type=mem_streambuf name=input_buf_/ +zorba:member type=std::istringstream name=input_iss_/ zorba:member type=std::vectorlt;store::Item_tgt; name=keys_/ zorba:member type=unsigned name=line_no_ defaultValue=1/ -zorba:member type=mem_streambuf name=mem_streambuf_/ zorba:member type=missing::type name=missing_ defaultValue=missing::null/ +zorba:member type=csv_parse_json_state name=parse_json_state_/ zorba:member type=bool name=skip_called_ defaultValue=false/ zorba:member type=zstring name=string_/ zorba:member type=zstring name=value_/ -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe :
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Review: Approve -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue starting for the following merge proposals: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue result for https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Stage BuildZorbaUbuntu failed. Check compiler output at http://jenkins.zorba.io:8180/job/BuildZorbaUbuntu/540/parsed_console to view the results. -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue starting for the following merge proposals: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Validation queue succeeded - proposal merged! -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been updated. Status: Approved = Merged For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/209825 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp