Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Marshal.load 2.9x regression vs JRuby 1.7 #9136

@tbsvttr

Description

@tbsvttr

Summary

Marshal.load shows a 2.9x performance regression in JRuby 10.0.2.0 compared to JRuby 1.7.27.

Benchmark Results

Operation JRuby 10.0.2.0 JRuby 1.7.27 MRI 3.4.7 Regression
Marshal.load only (medium) 0.0904s 0.0310s 0.0292s 2.9x
Marshal.dump/load (medium) 0.1312s 0.0763s 0.0555s 1.7x
Marshal.dump only (medium) 0.0393s 0.0450s 0.0261s 0.87x (faster)

The regression is specifically in Marshal.load - dump performance is actually slightly improved.

Test Code

medium_data = {
  :id => 1,
  :name => "test" * 100,
  :values => (1..1000).to_a,
  :nested => { :a => 1, :b => 2, :c => (1..100).to_a }
}

# Load only benchmark
dumped = Marshal.dump(medium_data)
1000.times { Marshal.load(dumped) }

Impact

This affects applications that:

  • Use Marshal for caching (Rails cache stores)
  • Perform inter-process communication via Marshal
  • Deserialize stored Ruby objects
  • Use sidekiq/resque job serialization

Environment

  • JRuby 10.0.2.0 with Java 21 (Temurin)
  • JRuby 1.7.27 with Java 8 (Corretto)
  • macOS Darwin 25.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions