Signal-iOS/Signal/test/PerformanceTests
Jordan Rose 7ba2a8ee2d Avoid deserializing envelope data more than necessary
Our envelopes go through a lot of transformations during processing:
0. If using REST, JSON delivered by the server is converted to
   SSKProtoEnvelope (MessageFetcherJob.buildEnvelope(messageDict:))
1a. If using REST, envelopes are serialized and enqueued for individual
    jobs (MessageFetcherJob.fetchMessagesViaRest())
1b. If using the web socket, the message is deserialized from protobuf
    (MessageProcessor.processEncryptedEnvelopeData(...))
2. If the envelope uses sealed sender, the sender is written into
   a new proto and reserialized
   (OWSMessageDecryptor.decryptUnidentifiedSenderEnvelope(...))
3. The serialized envelope is deserialized *again* for preprocessing,
   GV2 discard mode checking, and (potentially) actual processing.
   (MessageProcessor.processEnvelope(_:transaction:))
4. If the envelope is delayed, it'll be deserialized when it's finally
   processed
   (IncomingGroupsV2MessageJob.envelope)

This commit improves the situation by
- skipping the serialization in step #1a
- skipping the serialization in step #2
- reusing the SSKProtoEnvelope from decryption in message processing,
  avoiding the deserialization in step #3
- potentially serializing in step #4 if there's no up-to-date
  serialized data (either because the envelope was modified, or
  because it came from REST and we never had it in the first place)

Note that IncomingGroupsV2MessageJob is persisted across transactions
in the database, so it needs the envelope to be serialized.
2022-04-11 15:55:39 -07:00
..
ConversationLoadPerformanceTest.swift Remove isHidden column, use recordType instead 2021-08-26 20:57:06 -07:00
GroupsPerfTest.swift Fix some of the performance tests. 2020-10-16 10:15:16 -03:00
MessageProcessingPerformanceTest.swift Avoid deserializing envelope data more than necessary 2022-04-11 15:55:39 -07:00
MessageSendingPerformanceTest.swift Teach OWSIdentityManager about PNI identity keys 2022-03-16 13:29:20 -07:00
newlyInitializedSessionState Pre-compute some of SessionMigrationPerfTest's AxolotlKit input data 2021-03-22 16:18:30 -07:00
PerformanceBaseTest.swift Rework dependency access. 2021-03-25 09:24:27 -03:00
SDSPerformanceTest.swift Respond to CR. 2021-03-25 14:43:08 -03:00
SessionMigrationPerfTest.swift Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
ThreadFinderPerformanceTest.swift Move isArchived, isMarkedUnread, and mutedUntilDate off of TSThread 2021-05-13 12:54:33 -07:00
ThreadPerformanceTest.swift Respond to CR. 2021-03-25 14:43:08 -03:00
UnfairLockPerformanceTest.swift Fix some of the performance tests. 2020-10-16 10:15:16 -03:00