gerrit/gerrit-reviewdb/BUCK
Dave Borowitz 50678c33f2 Improve PatchSet.Id.fromRef performance and avoid double-parsing
If5a39210 optimized PatchSet.isRef() to improve the performance of
VisibleRefFilter during ref advertisement on large repositories.
However, typical large Gerrit repositories are dominated by patch set
refs, in which case the relatively slower PatchSet.Id.fromRef() would
be called after each call to isRef().

Teach fromRef() to return null for invalid refs, and switch to a
character-by-character implementation like the former isRef()
implementation, which also avoids any allocations until returning.

Add small tests for various ref formats; the new parser is somewhat
more strict.

On a test project with 50,000 changes (50,004 refs), this reduces
average ls-remote time on my MacBook Air by about 30%, 57653us to
40480us (3 warmup runs then average of 10).

Leave isRef(), now implemented as "fromRef() != null". This may be
marginally less efficient than before, since it involves allocating a
PatchSet.Id. This makes the code more maintainable; when writing
tests, I found several inconsistencies between the old
isRef()/fromRef() implementations. Rather than fix these, I stuck
with one implementation. In any case, remaining isRef() callers
are not called on every ref in the repo in a tight loop, so the
performance impact should be minimal.

Change-Id: I9dfb074a7c2312512960fd070aef323c33f80dbd
2014-08-07 13:30:04 -07:00

38 lines
793 B
Python

SRC = 'src/main/java/com/google/gerrit/reviewdb/'
TESTS = 'src/test/java/com/google/gerrit/reviewdb/'
gwt_module(
name = 'client',
srcs = glob([SRC + 'client/**/*.java']),
gwt_xml = SRC + 'ReviewDB.gwt.xml',
deps = [
'//gerrit-extension-api:client',
'//lib:gwtorm',
'//lib:gwtorm_src'
],
visibility = ['PUBLIC'],
)
java_library(
name = 'server',
srcs = glob([SRC + '**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-extension-api:api',
'//lib:gwtorm',
],
visibility = ['PUBLIC'],
)
java_test(
name = 'client_tests',
srcs = glob([TESTS + 'client/**/*.java']),
deps = [
':client',
'//lib:gwtorm',
'//lib:junit',
],
source_under_test = [':client'],
visibility = ['//tools/eclipse:classpath'],
)