33 Commits
Author SHA1 Message Date
rqueue 8f7444e0ec Add experiment to ensure ASCollectionView's range controller updates on changeset updates (#1976)
This experiment makes sure a ASCollectionView's `rangeController` updates when
a changeset WITH updates is applied. Currently it is possible for nodes
inserted into the preload range to not get preloaded when performing a batch
update.

For example, suppose a collection node has:
- Tuning parameters with a preload range of 1 screenful for the given range
  mode.
- Nodes A and B where A is visible and B is off screen.
Currently if node B is deleted and a new node C is inserted in its place, node
C will not get preloaded until the collection node is scrolled. This is because
the preloading mechanism relies on a `setNeedsUpdate` call on the range
controller as part of the `-collectionView:willDisplayCell:forItemAtIndexPath:`
delegate method when the batch update is submitted. However, in the example
outlined above, this sometimes doesn't happen automtically, causing the range
update to be delayed until the next the view scrolls.
2021-03-25 11:45:20 -07:00
Huy Nguyen 5a205d84c8 Fix failing ASConfigurationTests (#1923)
* Fix failing ASConfigurationTests

* Update configuration.json as well
2020-10-01 21:27:55 -07:00
Huy Nguyen 32679feb84 Add an experiment that makes ASDataController to do everything on main thread (#1911)
* Add an experiment that makes ASDataController to do everything on main thread

Under this experiment, ASDataController will allocate and layout all nodes on the main thread. This helps to avoid deadlocks that would otherwise occur if some of the node allocations or layouts caused ASDataController's background queue to block on main thread. As a bonus, this experiment also helps to measure how much performance wins we get from doing the work off main.

* Remove ASSERT_ON_EDITING_QUEUE
2020-09-17 18:04:17 -07:00
ricky f56a4dd1dd [Accessibility] Ship ASExperimentalDoNotCacheAccessibilityElements (#1888)
We did not notice any effect on performance of the Pinterest app by not caching `accessibilityElements` in `_ASDisplayView`. By not caching the elements, we can be sure that the elements will be correct even when nodes change visibility state. There will be a performance impact when voice over is enabled, but providing the correct elements for the current state of a view is more important than performance in this case.

https://github.com/TextureGroup/Texture/issues/1853
2020-07-23 15:21:07 -07:00
Greg Bolsinga bbb03b1e56 Ship ASExperimentalTraitCollectionDidChangeWithPreviousCollection (#1842)
- PINS shipped this experiment in 08/2019
2020-05-27 08:01:06 -07:00
Greg Bolsinga a6f9ceec71 Ship ASExperimentalUnfairLock experiment (#1841)
- Followup to #1742
- At Pinterest this shipped with D516974 in late 02/2020
- As discussed in #858 this is iOS10 or later, so the runtime `gMutex_unfair` check is still necessary for Texture.
2020-05-26 20:56:28 -07:00
Greg Bolsinga 343bbb1592 Ship ASExperimentalOOMBackgroundDeallocDisable since it decreases OOMs (#1840) 2020-05-26 15:44:31 -07:00
ricky d085cd6349 [ASDisplayViewAccessibility] A few accessibility improvements (#1812)
* [ASDisplayViewAccessibility] A few accessibility improvements

This diff includes a few improvements for accessibility in Texture.

* When determining a node’s accessibility elements, ignore any elements that are hidden, transparent, or out of the window. This matches UIKit’s behavior.
* When sorting the accessible elements and their origins are equal, give precedence to elements with shorter accessibility frames, followed by elements with narrower widths.
* Allow the ability to customize the comparator block that sorts the accessibility elements
* Create an experiment to stop caching accessibilityElements in `_ASDisplayView`. If we cache elements, we will require users to clear the cache (by calling `setAccessibilityElements` to get the side effect of clearing the cache) when nodes change their hidden state or opacity. This seems like a lot to request of the user. We will put this in an experiment so we can see the perf implication is both when using voice over and when not using voice over.

A few other notes:
* I got rid of the `ASAccessibilityElementPositioning` protocol in favor of passing `NSObjects` to the sort comparator. `NSObject` implements the informal `UIAccessibilityProtocol` and therefore has an `accessibilityFrame` property.
* I removed `static` from the `SortAccessibilityElements()` method definition. This allows me to declare it as `extern` in test it via unit tests.
2020-05-06 11:10:35 -07:00
trufflinandrgupta-pinterest 70613a655a Pruning ASExperimentalRemoveTextKitInitialisingLock code. (#1766)
* Remove code for unused ASExperimentalRemoveTextKitInitialisingLock experiment.

* Prune some additional unnecessary references.

Co-authored-by: rgupta-pinterest <59977334+rgupta-pinterest@users.noreply.github.com>
2020-01-28 14:37:55 -08:00
Huy Nguyen 6e46d9bcd5 [ASDataController] Add an experiment that avoids flushing editing queue before starting the data pipeline pipeline (#1564)
* [ASDataController] Avoid flushing editing queue before starting data controller pipeline

Step 1 of the pipeline is on main thread and needs pendingMap which was updated by the end of step 1 of the run. And step 1 operates on data source index space. So it should be ok to start it ASAP -- without waiting for any running work on the background editing queue.

One potential race condition after this change is that it's possible for main thread to query the data source (step 1) while the editing queue consumes the last change set (step 3). However, as long as the client's each nodeBlock and the node's layout code capture/reference an individual model object (as opposed to the whole data set) -- which is what clients are supposed to do anyways, then everything should be fine.

The benefit of this diff is that the pipeline will be able to accept many more change sets within a short time window, for example when clients submit a burst of separate small updates.

I tested this diff against our test suite several times and smoke tested it in our code base without any issues.

* Wrap in an experiment

* Enable experiment in tests

* Minor change
2019-06-30 21:08:06 -07:00
Greg Bolsinga c67acab290 Remove ASExperimentalTransactionOperationRetainCycle (#1547)
* Remove ASExperimentalTransactionOperationRetainCycle
2019-06-13 15:42:24 -07:00
Garrett Moon a3f25d05f9 Remove the text rendering experiment. (#1531)
* Remove the text rendering experiment. It decreased rendering speeds at a negligible improvement to OOMs.

* Adopt new ASGraphicsCreateImageWithOptions API
2019-06-03 08:56:31 -07:00
Michael Schneider 08d5e81e3b Remove ASExperimentalDisableAccessibilityCache (#1515)
* Remove ASExperimentalDisableAccessibilityCache

* Some more removal
2019-05-29 09:38:01 -07:00
Huy Nguyen e1859a1029 Ship ASExperimentalImageDownloaderPriority (#1480) 2019-05-21 22:23:24 -07:00
Huy Nguyen bf82b56253 Ship ASExperimentalFixRangeController (#1486) 2019-05-06 17:20:16 -07:00
Adlai Holler 64c43c0ded Add a new "global drawing" experiment to use UIGraphicsRenderer (#1469)
* Add a new "global drawing" experiment to use UIGraphicsRenderer everywhere, when available

* Fix logic

* Use preferredFormat
2019-05-02 20:42:23 -07:00
Wu Zhong 5aef12d4fb Try to remove global lock when initialising TextKit components (#1455)
* Try to remove global lock when initialising TextKit components

* Adding experiment flag to dis/enable lock of textkit component

* Adding tests

* code clean

fix typo

Make remove lock optional

Keep locks

code clean
2019-04-22 11:29:34 -07:00
Adlai Holler 38a67dd328 Shut down graphics contexts experiment (#1458)
* Shut down graphics contexts experiment

* Remove dead import

* Remove gone class
2019-04-18 18:36:39 -07:00
Greg Bolsinga 442317b8ab Wrap transaction operation retain cycle fix in an experiment (#1438)
* Wrap transaction operation retain cycle fix in an experiment

This is a follow on to #1429.

* fix typo in experiment name. fix copyright in tests file.
2019-04-01 16:11:52 -07:00
Michael Zuccarino 27cc0f2717 Experiment with disabling ASViewController background dealloc (#1420) 2019-03-25 14:11:04 -07:00
Huy Nguyen 09365b90ee Fix bug in ASRangeController that causes some cell nodes of a collection view which is about to becomes invisible to load their backing view/layer and render (#1418) 2019-03-22 06:40:18 -07:00
ernestmama 6f44c3921e Remove experimental features (exp_skip_a11y_wait && exp_new_default_cell_layout_mode) (#1383)
* Remove experimental features

* prevent blocking main thread

* remove small content all together as none is the default

* Update ASExperimentalFeatures.h
2019-03-11 13:34:35 -07:00
Garrett Moon 9b80eabd8f Adds support for using UIGraphicsImageRenderer in ASTextNode. (#1384)
* Adds support for using UIGraphicsImageRenderer in ASTextNode.

In many cases this reduces the backing store of text nodes by 1/2.

* Guard for UIGraphicsRenderer availability.

* Comma
2019-03-09 07:55:46 -08:00
Huy Nguyen d102ec81ee Experiment with different strategies for image downloader priority (#1349)
Right now when an image node enters preload state, we kick off an image request with the default priority. Then when it enters display state, we change the priority to "imminent" which is mapped to the default priority as well. This means that requests from preload and display nodes have the same priority and are put to the same pool. The right behavior would be that preload requests should have a lower priority from the beginning.

Another problem is that, due to the execution order of -didEnter(Preload|Display|Visible)State calls, a node may kick off a low priority request when it enters preload state even though it knows that it's also visible. By the time -didEnterVisibleState is called, the low priority request may have already been consumed and the download/data task won't pick up the new higher priority, or some work needs to be done to move it to another queue. A better behavior would be to always use the current interface state to determine the priority. This means that visible nodes will kick off high priority requests as soon as -didEnterPreloadState is called.

The last (and smaller) issue is that a node marks its request as preload/low priority as soon as it exits visible state. I'd argue that this is too agressive. It may be reasonble for nodes in the trailing direction. Even so, we already handle this case by (almost always) have smaller trailing buffers. So this diff makes sure that nodes that exited visible state will have imminent/default priority if they remain in the display range.

All of these new behaviors are wrapped in an experiment and will be tested carefully before being rolled out.

* Add imports

* Fix build failure

* Encapsulate common logics into methods

* Address comments
2019-03-08 08:11:03 -08:00
Garrett Moon fce6f23b97 Launches switching ASNetworkImageNode callbacks to global queue. (#1369)
* Launches switching ASNetworkImageNode callbacks to global queue.

* Good catch configuration tests!
2019-03-07 09:47:56 -08:00
Adlai Holler efeb3d2749 Add an experimental flag to use native dispatch_apply (#1345)
* Add an experimental flag to use native dispatch_apply instead of our core count * 2 approach. This has shown performance wins in some profiling.

* Add in other places
2019-02-21 12:33:39 -08:00
Huy Nguyen f1801388be Add experiments to skip waiting for updates of collection and table views under some circumstances (#1311)
* Add experiment to skip waiting until all updates of collection/table view are committed in -accessibilityElements

The wait was introduced in #1217 which blocks the main thread until updates are proccessed. We suspect this causes perf regressions accross the app and need to confirm this via an experiment.

* Add option to skip default behavior of ASCellLayoutMode

* Fix unit test

* Fix unit test in another way

* Remove import

* Minor change

* Add ASCellLayoutModeSyncForSmallContent

* Update unit tests

* Remove unnecessary change

* Remove unnecessary changes
2019-01-24 10:13:54 -08:00
Huy Nguyen 17e56042d3 Add a way to opt out of always-clear-data behavior in ASCollectionView and ASTableView (#1284) 2018-12-20 13:47:58 -08:00
Michael Schneider 5d2524be2c Update test imports (#1279) 2018-12-15 18:45:56 -08:00
Max Wang 4d9d3c26d9 Disable a11y cache (#1274)
* disable a11y cache

* style update
2018-12-09 08:41:18 -08:00
Michael Schneider f2bc63f05a Add way to compile out ASTextNode + TextKit dependencies (#1242)
* Add way to compile out ASTextNode + TextKit dependencies

* Compile out ASExperimentalTextNode and fix tests
2018-11-23 09:13:15 -08:00
Michael Schneider ecfc7835da Add experiment flag to skip layoutIfNeeded in enterPreloadState for ASM nodes (#1201) 2018-11-03 09:44:42 -07:00
Adlai Holler d0ba092a77 Convert the codebase to Objective-C++ (#1206)
* Convert the codebase to Objective-C++ throughout. One language is better than two.

* Put it back

* Fix linker

* Point explicitly to updated Weaver to unblock build

* Revert "Point explicitly to updated Weaver to unblock build"

This reverts commit fdc25296e8794d4e6e56c35f5fe6da2be3f71dbc.

* Revert "Fix linker"

This reverts commit 7be25f91519b8497ef42de79f115bcfbdb965c39.

* Add in the frameworks

* no message

* Address spec lint warnings

* Fix tvos build

* Put that back

* Address Michael's review

* Add comment to kick CI
2018-11-02 12:04:14 -07:00