We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
PERF: `to_set` speeds up especial for large data
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [x] whatsnew entry


| data                 | `set(s)`         | `set(s.unique())` |
| -------------------- | ---------------- | ----------------- |
| small, `list(range(10)`      | 1.83 µs ± 31.6 ns | 1.17 ms ± 144 µs |
| large, `list(range(10)*1000` | 9.67 µs ± 564 ns | 255 µs ± 14.9 µs |


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `dtoolkit/accessor/index/to_set.py`
Content:
```
1 import pandas as pd
2 
3 from dtoolkit.accessor.register import register_index_method
4 
5 
6 @register_index_method
7 def to_set(index: pd.Index) -> set:
8     """
9     Return a :keyword:`set` of the values.
10 
11     A sugary syntax wraps :keyword:`set`::
12 
13         set(index)
14 
15     Different to :meth:`~pandas.Index.unique`, it returns :class:`~pandas.Index`.
16 
17     Returns
18     -------
19     set
20 
21     See Also
22     --------
23     pandas.Index.unique
24 
25     Examples
26     --------
27     >>> import dtoolkit.accessor
28     >>> import pandas as pd
29     >>> i = pd.Index([1, 2, 2])
30     >>> i
31     Int64Index([1, 2, 2], dtype='int64')
32     >>> i.to_set()
33     {1, 2}
34     """
35 
36     return set(index)
37
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/dtoolkit/accessor/index/to_set.py b/dtoolkit/accessor/index/to_set.py
--- a/dtoolkit/accessor/index/to_set.py
+++ b/dtoolkit/accessor/index/to_set.py
@@ -33,4 +33,4 @@
     {1, 2}
     """
 
-    return set(index)
+    return set(index.unique())

{"golden_diff": "diff --git a/dtoolkit/accessor/index/to_set.py b/dtoolkit/accessor/index/to_set.py\n--- a/dtoolkit/accessor/index/to_set.py\n+++ b/dtoolkit/accessor/index/to_set.py\n@@ -33,4 +33,4 @@\n     {1, 2}\n     \"\"\"\n \n-    return set(index)\n+    return set(index.unique())\n", "issue": "PERF: `to_set` speeds up especial for large data\n<!--\r\nThanks for contributing a pull request!\r\n\r\nPlease follow these standard acronyms to start the commit message:\r\n\r\n- ENH: enhancement\r\n- BUG: bug fix\r\n- DOC: documentation\r\n- TYP: type annotations\r\n- TST: addition or modification of tests\r\n- MAINT: maintenance commit (refactoring, typos, etc.)\r\n- BLD: change related to building\r\n- REL: related to releasing\r\n- API: an (incompatible) API change\r\n- DEP: deprecate something, or remove a deprecated object\r\n- DEV: development tool or utility\r\n- REV: revert an earlier commit\r\n- PERF: performance improvement\r\n- BOT: always commit via a bot\r\n- CI: related to CI or CD\r\n- CLN: Code cleanup\r\n-->\r\n\r\n- [ ] closes #xxxx\r\n- [x] whatsnew entry\r\n\r\n\r\n| data                 | `set(s)`         | `set(s.unique())` |\r\n| -------------------- | ---------------- | ----------------- |\r\n| small, `list(range(10)`      | 1.83 \u00b5s \u00b1 31.6 ns | 1.17 ms \u00b1 144 \u00b5s |\r\n| large, `list(range(10)*1000` | 9.67 \u00b5s \u00b1 564 ns | 255 \u00b5s \u00b1 14.9 \u00b5s |\r\n\n", "before_files": [{"content": "import pandas as pd\n\nfrom dtoolkit.accessor.register import register_index_method\n\n\n@register_index_method\ndef to_set(index: pd.Index) -> set:\n    \"\"\"\n    Return a :keyword:`set` of the values.\n\n    A sugary syntax wraps :keyword:`set`::\n\n        set(index)\n\n    Different to :meth:`~pandas.Index.unique`, it returns :class:`~pandas.Index`.\n\n    Returns\n    -------\n    set\n\n    See Also\n    --------\n    pandas.Index.unique\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> i = pd.Index([1, 2, 2])\n    >>> i\n    Int64Index([1, 2, 2], dtype='int64')\n    >>> i.to_set()\n    {1, 2}\n    \"\"\"\n\n    return set(index)\n", "path": "dtoolkit/accessor/index/to_set.py"}], "after_files": [{"content": "import pandas as pd\n\nfrom dtoolkit.accessor.register import register_index_method\n\n\n@register_index_method\ndef to_set(index: pd.Index) -> set:\n    \"\"\"\n    Return a :keyword:`set` of the values.\n\n    A sugary syntax wraps :keyword:`set`::\n\n        set(index)\n\n    Different to :meth:`~pandas.Index.unique`, it returns :class:`~pandas.Index`.\n\n    Returns\n    -------\n    set\n\n    See Also\n    --------\n    pandas.Index.unique\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> i = pd.Index([1, 2, 2])\n    >>> i\n    Int64Index([1, 2, 2], dtype='int64')\n    >>> i.to_set()\n    {1, 2}\n    \"\"\"\n\n    return set(index.unique())\n", "path": "dtoolkit/accessor/index/to_set.py"}]}