mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	 0608a9a086
			
		
	
	
		0608a9a086
		
			
		
	
	
	
	
		
			
			* Optimize Marshal dump of large fixnum Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit platforms the 63-bit fixnums need to be represented in Marshal's BIGNUM. Previously this was done by converting to a bugnum and serializing the bignum object. This commit avoids allocating the intermediate bignum object, instead outputting the T_FIXNUM directly to a Marshal bignum. This maintains the same representation as the previous implementation, including not using LINKs for these large fixnums (an artifact of the previous implementation always allocating a new BIGNUM). This commit also avoids unnecessary st_lookups on immediate values, which we know will not be in that table. * Fastpath for loading FIXNUM from Marshal bignum * Run update-deps
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			740 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			740 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
| prelude: |
 | |
|   smallint_array = 1000.times.map { |x| x }
 | |
|   bigint32_array = 1000.times.map { |x| x + 2**32 }
 | |
|   bigint64_array = 1000.times.map { |x| x + 2**64 }
 | |
| 
 | |
|   smallint_dump = Marshal.dump(smallint_array)
 | |
|   bigint32_dump = Marshal.dump(bigint32_array)
 | |
|   bigint64_dump = Marshal.dump(bigint64_array)
 | |
| benchmark:
 | |
|   marshal_dump_integer_small: |
 | |
|     Marshal.dump(smallint_array)
 | |
|   marshal_dump_integer_over_32_bit: |
 | |
|     Marshal.dump(bigint32_array)
 | |
|   marshal_dump_integer_over_64_bit: |
 | |
|     Marshal.dump(bigint64_array)
 | |
|   marshal_load_integer_small: |
 | |
|     Marshal.load(smallint_dump)
 | |
|   marshal_load_integer_over_32_bit: |
 | |
|     Marshal.load(bigint32_dump)
 | |
|   marshal_load_integer_over_64_bit: |
 | |
|     Marshal.load(bigint64_dump)
 | |
| loop_count: 4000
 |