[PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 12:11:33 PDT 2015


EricWF added a comment.

Added more review comments for the boyer_moore searcher.


================
Comment at: include/experimental/functional:256
@@ +255,3 @@
+        
+public: // TODO private:
+    _RandomAccessIterator1 __first_;
----------------
Is this for testing?

================
Comment at: include/experimental/functional:313
@@ +312,3 @@
+
+    void build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, 
+                                                    _BinaryPredicate __pred)
----------------
This needs to be a reserved identifier right?

================
Comment at: include/experimental/functional:319
@@ +318,3 @@
+        {
+            _VSTD::vector<value_type> reversed(__count);
+            (void) _VSTD::reverse_copy(__f, __l, reversed.begin ());
----------------
It seems like we could do a lot more in this section to

1. Use less memory at any given time.
2. Reuse previously allocated memory.

I think the following changes could improve the QoI.

1. Move the loop that uses  `__prefix` to be directly following the initialization of it.
2. Pass reverse_iterator adaptors to `__compute_bm_prefix` instead of computing `reversed`.
3. Reuse the memory in `__prefix`  for `__prefix_reversed`. 

Unless I'm missing something those changes should be possible, and they reduce the amount of memory used by two thirds. 


http://reviews.llvm.org/D11380





More information about the cfe-commits mailing list