prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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 |
  
  
  </issue>
  <code>
  [start of dtoolkit/accessor/index/to_set.py]
  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 of dtoolkit/accessor/index/to_set.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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())
  
verification_info: {"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"}]}