Opened on 05/16/2014 at 06:14:17 PM

Closed on 02/04/2016 at 10:57:07 AM

#507 closed change (rejected)

[Typed objects] Implement a light-weight array.slice() method

Reported by: trev Assignee: kzar
Priority: P5 Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: #145 Platform: Unknown
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29323484/

Description

Background

In case of filters we will often have to work with a large string (complete filter text) as well as a number of its substrings (regexp source, options, domains etc). Creating the substrings via string constructor is suboptimal as it will copy the string data.

What to change

Implement an array.slice() method that will create a second array object accessing a subset of the original array's data. No copy operation should be necessary, the new array should simply have its arrayBufferIndex, arrayByteOffset and length properties set in such a way that they will point into the data of the original array. In order to prevent reallocations the length property should be made read-only for all slices as well as arrays that had slices created for them. Also, slices should keep a reference to the original array to prevent it from being garbage collected before them.

Attachments (0)

Change History (5)

comment:1 Changed on 05/27/2015 at 03:07:31 PM by kzar

  • Owner set to kzar
  • Platform set to Unknown

comment:2 Changed on 08/12/2015 at 05:23:49 PM by kzar

  • Review URL(s) modified (diff)
  • Tester set to Unknown

comment:3 Changed on 08/12/2015 at 05:24:11 PM by kzar

  • Status changed from new to reviewing

comment:4 Changed on 02/04/2016 at 07:55:37 AM by fhd

  • Priority changed from P2 to P5

Since the Emscripten based approach is looking rather good, I'm not sure we really want to continue to work on Typed Objects. Makes it a P5.

comment:5 Changed on 02/04/2016 at 10:57:07 AM by trev

  • Resolution set to rejected
  • Status changed from reviewing to closed

In fact, at that point I am certain that we are dropping typed objects and go with Emscripten instead. The performance issues we had with Emscripten initially are bound to affect us with typed objects as well (important points: static generation of JS bindings, stack-based allocations, likely more). Fixing these issues was already non-trivial with Emscripten, but with our own toolchain it will require far more effort - this isn't going to pay off if we have a reasonable and maintained alternative.

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from kzar.
 
Note: See TracTickets for help on using tickets.