NightOwl888 commented on code in PR #938: URL: https://github.com/apache/lucenenet/pull/938#discussion_r1713134026
########## src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs: ########## @@ -42,16 +43,16 @@ namespace Lucene.Net.Index [TestFixture] public class TestIndexWriterOnJRECrash : TestNRTThreads { - // LUCENENET: Setup unnecessary because we create a new temp directory + // LUCENENET: Setup of directory unnecessary because we create a new temp directory // in each iteration of the test. [Test] [Slow] - [AwaitsFix] + [Repeat(25)] Review Comment: Please remove `[Repeat(25)]` and re-add `[AwaitsFix]`, since this is something we will need to revisit in #894. ########## src/Lucene.Net/Support/ConcurrentHashSet.cs: ########## @@ -88,6 +88,21 @@ public int Count } } + private int CountInternal + { + get + { + int count = 0; + + foreach (var t in _tables.CountPerLock) Review Comment: I didn't benchmark, but it seems that using a for loop would be faster because we don't need to new up an enumerator. Or at least that is what I would do in absence of a benchmark, since that is what the original author and Microsoft did. ########## src/Lucene.Net/Support/ConcurrentHashSet.cs: ########## @@ -74,9 +74,9 @@ public int Count { AcquireAllLocks(ref acquiredLocks); - for (var i = 0; i < _tables.CountPerLock.Length; i++) + foreach (var t in _tables.CountPerLock) Review Comment: I didn't benchmark, but it seems that using a for loop would be faster because we don't need to new up an enumerator. Or at least that is what I would do in absence of a benchmark, since that is what the original author and Microsoft did. ########## src/Lucene.Net.Tests/Support/TestConcurrentHashSet.cs: ########## @@ -0,0 +1,51 @@ +using Lucene.Net.Attributes; +using Lucene.Net.Support; +using NUnit.Framework; +using System.Linq; +using System.Threading.Tasks; + +namespace Lucene.Net +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + public class TestConcurrentHashSet Review Comment: I added a link in #920 so this can be revisited. ########## src/Lucene.Net/Support/Native/Interop.MacOS.Constants.cs: ########## @@ -0,0 +1,28 @@ +namespace Lucene.Net.Support.Native Review Comment: Ideally, there wouldn't be a `Lucene.Net.Support` namespace (there is a Support folder to physically separate our changes from the Java source, but the trend is to put them into more logical namespaces). Let's change these to be `namespace Lucene.Net.Native` ########## src/Lucene.Net/Support/Native/Interop.Posix.Close.cs: ########## @@ -0,0 +1,31 @@ +using System.Runtime.InteropServices; + +namespace Lucene.Net.Support.Native +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + internal static partial class Interop + { + internal static partial class Posix Review Comment: What is the reason for using `Posix` here? Note that Microsoft separates `Linux` and `Unix` into separate classes. I don't know if that means we have to, but I just thought I would check. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org