The andpush gem (https://github.com/yuki24/andpush) vs the fcm gem (https://github.com/spacialdb/fcm)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
require 'andpush' | |
require 'fcm' | |
server_key = ENV.fetch('FCM_TEST_SERVER_KEY') | |
DEVICE_TOKEN = ENV.fetch('FCM_TEST_REGISTRATION_TOKEN') | |
FCM_CLIENT = FCM.new(server_key) | |
PAYLOAD_FOR_FCM = { dry_run: true, notification: { title: "u", body: "y" } } | |
ANDPUSH_CLIENT = Andpush.build(server_key) | |
PAYLOAD_FOR_ANDPUSH = PAYLOAD_FOR_FCM.merge(to: DEVICE_TOKEN) | |
REGISTRATION_TOKENS = [DEVICE_TOKEN] | |
Benchmark.ips do |x| | |
x.report("andpush") { ANDPUSH_CLIENT.push(PAYLOAD_FOR_ANDPUSH).json } | |
x.report("fcm") { FCM_CLIENT.send(REGISTRATION_TOKENS, PAYLOAD_FOR_FCM) } | |
x.compare! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warming up -------------------------------------- | |
andpush 2.000 i/100ms | |
fcm 1.000 i/100ms | |
Calculating ------------------------------------- | |
andpush 28.009 (± 7.1%) i/s - 140.000 in 5.019399s | |
fcm 7.452 (±13.4%) i/s - 37.000 in 5.023139s | |
Comparison: | |
andpush: 28.0 i/s | |
fcm: 7.5 i/s - 3.76x slower |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment